On a symfony2 controller, I would like to test a controller, which return a Response object. My test class extends from WebTestCase. I use the static::createClient() to get an operational client.

My problem is to call the good route on my current installation with a virtual host.

$client->getContainer()->get('router')->generate('my_route', array(), true) generate a route with localhost as host. But that doesn't work as I have myproject.local as host.

$client->getContainer()->get('kernel')->getRootDir() and other dir method provide linux file path, not web path.

I cannot hard code it as I am not alone on the project. So what is the method to get the correct route, or is there another way to test the controller?

Edit
Report