You can set these values ββas DIC (Container Injection Container) parameters in config/config_test.yml .
Basically just add them like this:
parameters: myapp.test.hostname.somehost: http:
You can then create a helper method in your test class to get the URL for a specific host:
private function getHostUrl($hostId, $path = '') { return self::$kernel->getContainer()->getParameter('myapp.test.hostname.'.$hostId).$path; }
Note. I assume you are using WebTestCase .
Finally, use this in your test:
$crawler = $client->request('GET', $this->getHostUrl('somehost', '/lang/120'));
igorw
source share