0

I try to make some tests for my project but I have issue. When I launch Unit tests with PHPUnit it's works perfectly but when I try to do functional tests (with extends WebTestCase), there is an error.

I run 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

I have read some topics about this error but I still don't understand. Can you help me ? Thanks.

4
  • do you have a phpunit.xml in your app folder? What are the contents of your composer.json ? Commented Jun 23, 2017 at 13:51
  • Yes I have a phpunit.xml in my app/ folder but it was not auto-generated. I written it myself. Commented Jun 23, 2017 at 14:39
  • Looks like autoloading is not work did you load your composers vendor/autoload.php file in your phpunit.xml or try stackoverflow.com/questions/25219764/… Commented Jun 23, 2017 at 14:41
  • try with phpunit -c app --filter=fileTest Commented Jun 23, 2017 at 18:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.