Answer the question
In order to leave comments, you need to log in
How to name tests for Laravel? Annotation or prefix "test"?
Actually, what is the correct name for functions for tests, or how do you call them in your company?
according to PSR, I have to call functions in camelCase, but at the same time, Laravel itself (just like Symfony) generates snake_case through make
public function test_example()
{
$response = $this->get('/');
$response->assertStatus(200);
}
/**
* @test
*/
public function some_example()
{
$response = $this->get('/');
$response->assertStatus(200);
}
public function test_some_example()
{
$response = $this->get('/');
$response->assertStatus(200);
}
Answer the question
In order to leave comments, you need to log in
I prefer prefix. Simply because it does not require a separate line in the docblock, which is already growing due to argument descriptions, data providers, and a human-readable test name.
Names in snake_case are preferable because long method names in camelCase are much harder to read.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question