我的symfony2应用程序正在使用phpunit完美地在wamp(windows)上工作但是当安装后更改环境并开始使用lampp(linux)时,通过输入phpunit -c app /运行测试时出现以下错误:`/opt/lampp/htdocs/VTALLY/src/Iballot/CmsBundle/Tests/Controller/ParliamentaryControllerTest.php:11
引起的 Symfony \ Component \ Yaml \ Exception \ ParseException:保留指示符" @"不能开始一个普通的标量;你需要在第4行引用标量(接近"参数:[@ security.context,@ fos_user.user_manager]")。“
答案 0 :(得分:3)
您需要在引号中放置以describe User do
let(:user) { User.new }
it "should define the association" do
expect(user).to have(:no).errors_on(:surveys)
end
end
describe Survey do
let(:user) { User.new }
let(:survey) { user.surveys.create }
it "should define the association" do
expect(survey).to have(:no).errors_on(:user)
end
end
开头的任何字符串:
@
应引用保留字符,例如arguments:
["@security.context", "@fos_user.user_manager"]
。未加引号@
s were deprecated in Symfony 2.8。 Symfony 3.0将禁止您使用此类定义,并将抛出异常。
如果您无法控制注册有问题配置的软件包,请向供应商发送带有修复程序的pull请求。作为快速解决方案,您可以降级Symfony。 2.7将起作用,以及2.8(后者只会发出弃用通知)。