Skip to content

Overriding test.client.parameters for HTTP_HOST does not work with WebTestCase #12189

Closed
@adrienbrault

Description

@adrienbrault

Hi,

I've tried to override the test client HTTP_HOST server param in my app config:

parameters:
    test.client.parameters:
        HTTP_HOST: symfony.com

However, in functional tests (WebTestCase), $client->getServerParameter('HTTP_HOST') does not return symfony.com but the default localhost.

The client is actually correctly configured at

$client = static::$kernel->getContainer()->get('test.client');

but the call on the next line $client->setServerParameters($server); with an empty array erases HTTP_HOST because of the method definition:

public function setServerParameters(array $server)
{
$this->server = array_merge(array(
'HTTP_HOST' => 'localhost',
'HTTP_USER_AGENT' => 'Symfony2 BrowserKit',
), $server);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions