Skip to content

Commit

Permalink
Change test case methods to snake_case
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JohnnyWalkerDigital authored May 19, 2023
1 parent 548fa70 commit b844b60
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ Primary key | - | id | ~~custom_id~~
Migration | - | 2017_01_01_000000_create_articles_table | ~~2017_01_01_000000_articles~~
Method | camelCase | getAll | ~~get_all~~
Method in resource controller | [table](https://laravel.com/docs/master/controllers#resource-controllers) | store | ~~saveArticle~~
Method in test class | camelCase | testGuestCannotSeeArticle | ~~test_guest_cannot_see_article~~
Method in test class | snake_case | test_guest_cannot_see_article | ~~testGuestCannotSeeArticle~~
Variable | camelCase | $articlesWithAuthor | ~~$articles_with_author~~
Collection | descriptive, plural | $activeUsers = User::active()->get() | ~~$active, $data~~
Object | descriptive, singular | $activeUser = User::active()->first() | ~~$users, $obj~~
Expand Down

0 comments on commit b844b60

Please sign in to comment.