我是 PHP 和 Codeception 以及单元测试的整个概念的新手。到目前为止,我已经遵循 Codeception 的快速入门指南 ( http://codeception.com/quickstart ) 并阅读了他们的文档 ( http://codeception.com/docs/05-UnitTests )。
我已经设法设置了测试环境,并且
- 创建单元测试文件 (
php codecept.phar generate:test unit ExampleTest
) - 运行测试命令 (
php codecept.phar run unit ExampleTest
),它返回错误:
有 1 个错误:
1) ExampleTest: Validation Test tests\unit\ExampleTest.php:testValidation [Error] Class 'User' not found #1 ExampleTest->testValidation #2 C:\laragon\www\kario\vendor\bin\codecept.phar:5
我不明白的是测试文件如何知道要在哪个 PHP 文件上运行测试?
我的 laragon 项目名为kario
,并且在C:\laragon\www\kario\resources\views\pages\orders
测试单元文件位于C:\laragon\www\kario\vendor\bin\tests\unit
.