I'm actually testing a bundle that I created. All the code is fully unit tested but now, I want to test if my symfony2 services can 开发者_开发百科be request without any trouble.
For that, I need the symfony2 dependency injection container in my test case. How can I do that ?
I recently asked a question similar to this in that I needed just the validator, however the person who replied to my question first had a solution which gave access to the whole container.
Basically you can pick apart WebTestCase
in order to see how it builds the Symfony2 environment and make your own base class which is Symfony aware as it were.
Here is the answer, I hope it helps: Symfony2: Testing entity validation constraints
精彩评论