dev-resources.site
for different kinds of informations.
Laravel tests naming rules
Published at
1/7/2021
Categories
laravel
testing
standard
rules
Author
diogoko
Author
7 person written this
diogoko
open
There is one important information about Laravel testing that may not be obvious when reading the official documentation: the names of test classes and test methods must follow some simple rules stated below.
- Test classes must end with the suffix
Test
- Test methods must start with the prefix
test
This detail has bitten me more than once in the past. You copy and paste ExampleTest.php
to create, say, ExampleTest2.php
and the artisan command insists in ignoring your otherwise perfect test class!
The explanation is simple: under the hood, php artisan test
and php artisan dusk
use PHPUnit to run the tests, so default PHPUnit's rules apply. That's why you can also use test annotations if you really want to avoid prefixing your test methods with test
:
/**
* @test
*/
public function sendsConfirmationEmail()
{
...
}
standard Article's
16 articles in total
The Open Source AI : Understanding the New Standard
read article
Decentralized Application Gold Standard
read article
What are Api Standards or REST Style?
read article
Introducing Our New JavaScript Standard Library
read article
MISRA C Standard
read article
Diving Deep into the HTML Living Standard
read article
Just in time documentation is the right documentation
read article
Standard deviation formula with examples
read article
On big binaries names
read article
Deep Dive Beyond Operator Overloading in JavaScript
read article
Standardizing Code — EditorConfig
read article
WHO CARES ABOUT CODING STANDARDS?
read article
Laravel tests naming rules
currently reading
Meteor and standard lint
read article
#30DaysOfCJS: Enabling Web Developers to Build the Future of the Web
read article
Software Quality?
read article
Featured ones: