在 CodeIgniter 4 的 class "Tests\Support\UserDatabaseTest" 中找不到测试

No tests found in class "Tests\Support\UserDatabaseTest" in CodeIgniter 4

我需要你的帮助,我仍在学习 codeigniter 4 并尝试构建一个应用程序, 当我对我的数据库和模型进行测试并在我 运行 测试

时显示如下时,我发现了一个问题
> phpdbg -qrr .\vendor\bin\phpunit
PHPUnit 9.5.4 by Sebastian Bergmann and contributors.

W                                                                   1 / 1 (100%)

Time: 00:00.094, Memory: 10.00 MB

There was 1 warning:

1) Warning
No tests found in class "Tests\Support\UserDatabaseTest".

WARNINGS!
Tests: 1, Assertions: 0, Warnings: 1.

Generating code coverage report in Clover XML format ... done [00:00.179]

Generating code coverage report in HTML format ... done [00:00.663]

Generating code coverage report in PHP format ... done [00:00.017]


Code Coverage Report:   
  2021-04-05 09:17:15   

 Summary:
  Classes:  0.00% (0/4) 
  Methods:  0.00% (0/4) 
  Lines:    0.00% (0/19)

我的测试只有一个测试,测试是测试数据我的用户数据库测试和软删除这样 UserDatabaseTest

namespace Tests\Support;

use Tests\Support\Database\DatabaseTest;
use CodeIgniter\Test\CIDatabaseTestCase;

class UserDatabaseTest extends CIDatabaseTestCase
{
    protected $migrate = true;
    protected $refresh  = true;
    protected $seed = "UserSeeder";


    public function setUp(): void
    {
        parent::setUp();
    }

    public function tearDown(): void
    {
        parent::tearDown();
    }

    public function userFindAllTest()
    {
        $model = model('UserModel');
        $objects = $model->findAll();

        $this->assertCount(30, $objects);
    }

    public function UserSoftDeleteTests()
    {
        $model = model('UserModel');

        $object = $model->first();
        $model->delete($object->id);

        $this->assertNull($model->find($object->id));

        $criteria = ['id' => $object->id, 'deleted_at' => null];
        $this->dontSeeInDatabase('users', $criteria);

        $criteria = ['deleted_at' => null];
        $this->seeNumRecords(29, 'users', $criteria);
    }
}

我对问题和如何解决问题一无所知,感谢您之前的帮助。

完整项目github

所有的测试方法都要以“test”开头。因此,userFindAllTest 将更改为 testUserFindAllTest,而 UserSoftDeleteTests 将更改为 testUserSoftDeleteTests。此外,命名测试方法的最佳做法是使用小写字母和带下划线的分隔词。因此,testUserFindAllTest 应该是 test_user_find_all(最后删除测试,因为它是隐含的)。