$client =
$this->
getBrowser();
$client->
request('GET', 'https://example.com/foo',
[],
[],
['HTTP_HOST' => '127.0.0.1'
]);
$this->
assertSame('https://example.com/foo',
$client->
getRequest()->
getUri());
$headers =
$client->
getRequest()->
getServer();
$this->
assertSame('127.0.0.1',
$headers['HTTP_HOST'
]);
} public function testGetResponse() { $client =
$this->
getBrowser();
$client->
setNextResponse(new Response('foo'
));
$client->
request('GET', 'http://example.com/'
);
$this->
assertSame('foo',
$client->
getResponse()->
getContent(), '->getCrawler() returns the Response of the last request'
);
$this->
assertInstanceOf(Response::
class,
$client->
getResponse(), '->getCrawler() returns the Response of the last request'
);
} public function testGetResponseNull() { $this->
expectException(BadMethodCallException::
class);
$this->
expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getResponse()".'
);