Keep getting #39;You have requested a non-existent service quot;test.clientquot;#39; in Symfony2 Beta3(不断收到“您请求了一个不存在的服务test.client“在 Symfony2 Beta3 中)
问题描述
我正在尝试设置单元测试,但每当我运行phpunit -c app"时,我都会收到此错误:
I'm trying to setup a unit test but whenever I run "phpunit -c app" I get this error:
SymfonyComponentDependencyInjectionExceptionServiceNotFoundException:您请求了一个不存在的服务test.client".
SymfonyComponentDependencyInjectionExceptionServiceNotFoundException: You have requested a non-existent service "test.client".
我的测试用例中的代码只是:
The code in my test case is just:
public function testNonAuthenticatedPathsIndex()
{
$client = $this->createClient();
}
如果我不调用 createClient,一切都会正常运行.我检查了 AppKernel.php 以确保 FrameworkBundle(我相信这是定义此服务的位置)肯定仍然存在并且确实存在.
If I don't make the call to createClient everything runs correctly. I've checked AppKernel.php to make sure the FrameworkBundle (I believe that's where this service is defined) is definitely still in there and it is.
我对可能导致这种情况的原因有点困惑,因为我以前曾设法做这种事情.
I'm a bit confused as to what might be causing this as I've managed to do this kind of thing before.
感谢您的帮助.
推荐答案
你是否在config_test.yml中启用了framework.test
选项?
Have you enabled the framework.test
option in config_test.yml?
framework:
test: ~
这篇关于不断收到“您请求了一个不存在的服务"test.client“"在 Symfony2 Beta3 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:不断收到“您请求了一个不存在的服务"test.client“"在 Symfony2 Beta3 中


- Mod使用GET变量将子域重写为PHP 2021-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- Laravel 仓库 2022-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01