我尝试为我的项目进行一些测试但是我有问题。
当我使用PHPUnit启动单元测试时,它可以很好地工作但是当我尝试进行功能测试时(使用extends WebTestCase
),会出现错误。
我运行phpunit -c app/ src/path/to/my/fileTest.php
:
PHP Fatal error: Uncaught PHPUnit\Runner\Exception: Class 'src/Eat/MainBundle/Tests/Controller/PaiementControllerTest' could not be found in '/Applications/MAMP/htdocs/PopLink/Symfony/src/Eat/MainBundle/Tests/Controller/PaiementControllerTest.php'. in phar:///usr/local/bin/phpunit/phpunit/Runner/StandardTestSuiteLoader.php:101
Stack trace:
#0 phar:///usr/local/bin/phpunit/phpunit/Runner/BaseTestRunner.php(130): PHPUnit\Runner\StandardTestSuiteLoader->load('src/Eat/MainBun...', '/Applications/M...')
#1 phar:///usr/local/bin/phpunit/phpunit/Runner/BaseTestRunner.php(73): PHPUnit\Runner\BaseTestRunner->loadSuiteClass('src/Eat/MainBun...', '/Applications/M...')
#2 phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php(162): PHPUnit\Runner\BaseTestRunner->getTest('src/Eat/MainBun...', '/Applications/M...', Array)
#3 phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php(141): PHPUnit\TextUI\Command->run(Array, true)
#4 /usr/local/bin/phpunit(546): PHPUnit\TextUI\Command::main()
#5 {main}
thrown in phar:///usr/local/bin/phpunit/phpunit/Runner/StandardTestSuiteLoader.php on line 101

我已经阅读了有关此错误的一些主题,但我仍然不明白。 你能帮助我吗 ? 感谢。