Laravel
① Add
② Add
【Laravel】How to Solve 'No tests found in class' in PHPunit
Thank you for your continued support.
This article contains advertisements that help fund our operations.
Table Of Contents
PR
This article explains how to solve the 'No tests found in class' issue when creating tests with PHPunit in Laravel.
Error Message
No tests found in class "Tests\Feature\PostTest".
Solution
There are two ways to solve this issue.
- Add
test
to the function name - Add
@test
above the function
① Add test
to the function name
Function name in Japanese (snake_case)
/**
* A basic feature test example.
*
* @return void
*/
public function test_記事の投稿()
{
// Test implementation
}
Snake case
/**
* A basic feature test example.
*
* @return void
*/
public function test_postStoreTest()
{
// Test implementation
}
Camel case
/**
* A basic feature test example.
*
* @return void
*/
public function testPostStoreTest()
{
// Test implementation
}
② Add @test
above the function
/**
* A basic feature test example.
* @test
* @return void
*/
public function 記事の投稿()
{
// Test implementation
}
Any of these methods will work; follow the style of other test code in your project.
As a Japanese developer, I feel comfortable writing in Japanese.
Please Provide Feedback
We would appreciate your feedback on this article. Feel free to leave a comment on any relevant YouTube video or reach out through the contact form. Thank you!