Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
305 views
in Technique[技术] by (71.8m points)

php - Keep getting 'You have requested a non-existent service "test.client"' in Symfony2 Beta3

I'm trying to setup a unit test but whenever I run "phpunit -c app" I get this error:

SymfonyComponentDependencyInjectionExceptionServiceNotFoundException: You have requested a non-existent service "test.client".

The code in my test case is just:

public function testNonAuthenticatedPathsIndex()
{
    $client = $this->createClient();
}

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.

Thanks for any help.

question from:https://stackoverflow.com/questions/6213628/keep-getting-you-have-requested-a-non-existent-service-test-client-in-symfon

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Have you enabled the framework.test option in config_test.yml?

framework:
  test: ~

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...