Skip to content

Commit

Permalink
test: add tests for REMOTE_ADDR
Browse files Browse the repository at this point in the history
  • Loading branch information
alanpoulain committed Sep 24, 2021
1 parent 4167554 commit 547b93b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/Bridge/Symfony/Bundle/Test/ClientTest.php
Expand Up @@ -58,10 +58,15 @@ public function testCustomHeader(): void
$response = $client->request('POST', '/dummies', [
'headers' => [
'content-type' => 'application/json',
'remote-addr' => '10.10.10.10',
'accept' => 'text/xml',
],
'body' => '{"name": "Kevin"}',
]);
$server = $client->getKernelBrowser()->getInternalRequest()->getServer();
$this->assertSame('application/json', $server['CONTENT_TYPE']);
$this->assertSame('10.10.10.10', $server['REMOTE_ADDR']);
$this->assertSame('text/xml', $server['HTTP_ACCEPT']);
$this->assertSame('application/xml; charset=utf-8', $response->getHeaders()['content-type'][0]);
$this->assertResponseHeaderSame('content-type', 'application/xml; charset=utf-8');
$this->assertStringContainsString('<name>Kevin</name>', $response->getContent());
Expand Down

0 comments on commit 547b93b

Please sign in to comment.