问题
My symfony2 application is working with phpunit perfectly on wamp (windows) but when a change the environment and start to work on lampp (linux) after installing, I get the following error when run the test by typing phpunit -c app/: `/opt/lampp/htdocs/VTALLY/src/Iballot/CmsBundle/Tests/Controller/ParliamentaryControllerTest.php:11
Caused by Symfony\Component\Yaml\Exception\ParseException: The reserved indicator "@" cannot start a plain scalar; you need to quote the scalar at line 4 (near "arguments: [@security.context, @fos_user.user_manager]").`
回答1:
You need to put any strings starting with @
in quotes:
arguments:
["@security.context", "@fos_user.user_manager"]
Reserved characters, like @
, should be quoted. Unquoted @
s were deprecated in Symfony 2.8. Symfony 3.0 will forbid you to use such definitions and will throw an exception.
If you don't have control over the bundle that registered the problematic configuration, send a pull request with a fix to the vendor. As a quick fix you can downgrade Symfony. 2.7 will work, as well as 2.8 (the later will only emit a deprecation notice).
来源:https://stackoverflow.com/questions/34990017/symfony2-and-phpunit-does-not-work-on-lampp-ubuntu-15-x