phpunit-docker icon indicating copy to clipboard operation
phpunit-docker copied to clipboard

Can't find class in file. Autoload doesn't work.

Open elonmallin opened this issue 6 years ago • 1 comments

I'm trying to run a simple test in my project but I'm stuck on autoload problems. How do I run this image?

Simply doing: docker run --rm -v ${PWD}:/app --rm phpunit/phpunit run like in the readme gives Cannot open file "run.php" And I do have a phpunit.xml file.

And trying one of the more advanced: docker run --rm -v ${PWD}:/app --rm phpunit/phpunit /app/tests/AppBundle/StandaloneTest.php --filter testStandalone or docker run --rm -v ${PWD}:/app --rm phpunit/phpunit -c /app/phpunit.xml /app /tests/AppBundle/StandaloneTest.php --filter testStandalone or docker run --rm -v ${PWD}:/app --rm phpunit/phpunit --bootstrap /app/app/autoload .php /app/tests/AppBundle/StandaloneTest.php --filter testStandalone

All give:

PHP Fatal error:  Uncaught PHPUnit\Runner\Exception: Class '/app/tests/AppBundle/StandaloneTest' could not be found in '/app/tests/AppBundle/StandaloneTest.php'. in /tmp/vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php:102
Stack trace:
#0 /tmp/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php(130): PHPUnit\Runner\StandardTestSuiteLoader->load('/app/tests/AppB...', '/app/tests/AppB...')
#1 /tmp/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php(73): PHPUnit\Runner\BaseTestRunner->loadSuiteClass('/app/tests/AppB...', '/app/tests/AppB...')
#2 /tmp/vendor/phpunit/phpunit/src/TextUI/Command.php(169): PHPUnit\Runner\BaseTestRunner->getTest('/app/tests/AppB...', '/app/tests/AppB...', Array)
#3 /tmp/vendor/phpunit/phpunit/src/TextUI/Command.php(148): PHPUnit\TextUI\Command->run(Array, true)
#4 /tmp/vendor/phpunit/phpunit/phpunit(53): PHPUnit\TextUI\Command::main()
#5 {main}
  thrown in /tmp/vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php on line 102

I'm on Windows 10 running Docker version 18.09.2, build 6247962 in Powershell.

elonmallin avatar Feb 19 '19 21:02 elonmallin

I have the same experience from host os linux mint 20

this issue is over 1.5 years old with no comments?

tempcke avatar Nov 01 '20 20:11 tempcke