Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Documentation Invalid for Testing Host Matched Routes #6421

Copy link
Copy link
Closed
@tomchkk

Description

@tomchkk
Issue body actions

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

No one assigned

    Labels

    TestingactionableClear and specific issues ready for anyone to take them.Clear and specific issues ready for anyone to take them.bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.