I recently asked a question similar to this one in which I only need a validator, however the person who first answered my question had a solution that gave access to the entire container.
Basically, you can highlight WebTestCase
to see how it creates a Symfony2 environment and create your own base class, which is known to be Symfony.
Here is the answer, I hope this helps: Symfony2: Entity Authentication Limitations
source share