Closed
Description
The section Testing your Controllers in the How to Match a Route Based on the Host document no longer appears to be valid from Symfony 2.8.
The documentation indicates to set the Host HTTP header on the request:
$crawler = $client->request(
'GET',
'/homepage',
array(),
array(),
array('HTTP_HOST' => 'm.' . $client->getContainer()->getParameter('domain'))
);
After recently updating my application from 2.7 to 2.8, I found that this technique no longer works, and seems to have been invalided by the fix for issue #15398.
As per the amended test class src/Symfony/Component/BrowserKit/Tests/ClientTest.php
the correct method now appears to be to provide the full uri to the $client->request()
method.
The updated test request might instead look like this:
$uri = 'm.' . $client->getContainer()->getParameter('domain')) . '/homepage';
$crawler = $client->request('GET', $uri);
Metadata
Metadata
Assignees
Labels
Clear and specific issues ready for anyone to take them.Clear and specific issues ready for anyone to take them.