我一直在 Laravel 项目中使用 Pingpong 模块。因此,每个模块都有一个 Test
目录。但是,如果我在那里编写 PHPUnit 测试用例,它不会按预期执行。它只执行根测试文件夹中的测试用例。为了执行模块明智的测试用例,我需要进行任何配置更改吗?
最佳答案
您可以将其添加到您的 phpunit.xml 文件中:
<testsuites>
<testsuite name="Application Test Suite">
<testsuite name="Modules Test Suite">
<directory>./Modules/*/Tests</directory>
</testsuite>
</testsuite>
</testsuites>
这样,当您运行整个测试套件时,它将在每个模块的每个测试文件夹中执行测试。
关于unit-testing - Laravel 模块智能单元测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35402982/