Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change test case methods to snake_case and mention Pest support #169

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JohnnyWalkerDigital
Copy link
Contributor

@JohnnyWalkerDigital JohnnyWalkerDigital commented May 19, 2023

Update naming convention to match official Laravel documentation. (These "best practices" are currently out-of-step with modern Laravel standards.)

Reasoning:

Update naming convention to match official Laravel documentation. These best practices are currently out-of-step with modern Laravel standards.

 * Laravel [officially changed to snake_case](laravel/laravel#5574) for test case methods in version 8.0. 
 * [Official Laravel documentation](https://laravel.com/docs/10.x/testing) uses snake_case. 
 * [Laracast videos](https://laracasts.com/series/phpunit-testing-in-laravel/episodes/2) use snake_case. 
 * The [previous discussion's](alexeymezenin#28) conclusions on this matter are no longer correct.
@JohnnyWalkerDigital
Copy link
Contributor Author

@alexeymezenin You seem to be engaging with this repo again... How about bringing it up to speed with current Laravel standards?

@Tpojka
Copy link

Tpojka commented Oct 24, 2023

Snake case should be used in tests regardless Laravel.

It differs from regular methods and force developer to pay extreme attention to those.
It differs from regular (app) methods that should be written following PSR standards.
Personally, I comply/obey 100% PSR standards which means I use camelCase for methods, but for testing methods I use snake_case.

Updated to show the official support for Pest
@JohnnyWalkerDigital JohnnyWalkerDigital changed the title Change test case methods to snake_case Change test case methods to snake_case and mention Pest support Sep 11, 2024
@JohnnyWalkerDigital
Copy link
Contributor Author

JohnnyWalkerDigital commented Sep 11, 2024

@alexeymezenin Are you ever going to address this issue? I want to use this repo as a reference, but I can't while it's outdated.

@alexeymezenin
Copy link
Owner

@JohnnyWalkerDigital Hi. I believe this was discussed before, I also remember mentioning huge discussion on this topic which took place many years ago. Long story short, there is no reason to use snake case just for PHPUnit tests just because some people got used to it.

Laravel is following PSR coding standards and snake case clearly violates those https://laravel.com/docs/11.x/contributions#coding-style

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants