ParameterNotFoundException已被删除,但我仍然收到错误?

时间:2017-01-20 23:25:25

标签: symfony

在symphony项目上运行phpunit时出现此错误

Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException: You have requested a non-existent parameter "secret_parameter".

参数位于.html.twig文件中。我试图通过删除带有“secret_parameter”的行来抑制错误。

字符串“secret_parameter”已不在我的项目中。

但是,如果我尝试运行phpunit,我仍然会遇到同样的错误。

为什么?

我已尝试运行此行来清除缓存,但它没有帮助:

php bin/console cache:clear

我的错误的完整堆栈跟踪是:

/home/jon/NetBeansProjects/spankthatmonkey/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:84
/home/jon/NetBeansProjects/spankthatmonkey/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:200
/home/jon/NetBeansProjects/spankthatmonkey/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:171
/home/jon/NetBeansProjects/spankthatmonkey/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:161
/home/jon/NetBeansProjects/spankthatmonkey/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:161
/home/jon/NetBeansProjects/spankthatmonkey/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:161
/home/jon/NetBeansProjects/spankthatmonkey/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php:45
/home/jon/NetBeansProjects/spankthatmonkey/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php:39
/home/jon/NetBeansProjects/spankthatmonkey/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:104
/home/jon/NetBeansProjects/spankthatmonkey/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:571
/home/jon/NetBeansProjects/spankthatmonkey/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:510
/home/jon/NetBeansProjects/spankthatmonkey/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:132
/home/jon/NetBeansProjects/spankthatmonkey/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:145
/home/jon/NetBeansProjects/spankthatmonkey/tests/HelloWorld/UserBundle/Entity/UserRepositoryTest.php:23

1 个答案:

答案 0 :(得分:1)

当你这样做时

php bin/console cache:clear

您正在清除开发环境的缓存。

Phpunit使用测试环境。

你应该做

php bin/console cache:clear --env=test