JulienBreux / phpunit-docker

DEPRECATED :package: Docker image to use PHPUnit as CLI.
https://hub.docker.com/r/phpunit/phpunit/
MIT License
47 stars 28 forks source link

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

Open elonmallin opened 5 years ago

elonmallin commented 5 years ago

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.

tempcke commented 4 years ago

I have the same experience from host os linux mint 20

this issue is over 1.5 years old with no comments?