You are here

public function ClientTest::testSetServerParameterInRequest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/browser-kit/Tests/ClientTest.php \Symfony\Component\BrowserKit\Tests\ClientTest::testSetServerParameterInRequest()

File

vendor/symfony/browser-kit/Tests/ClientTest.php, line 606

Class

ClientTest

Namespace

Symfony\Component\BrowserKit\Tests

Code

public function testSetServerParameterInRequest() {
  $client = new TestClient();
  $this
    ->assertEquals('localhost', $client
    ->getServerParameter('HTTP_HOST'));
  $this
    ->assertEquals('Symfony2 BrowserKit', $client
    ->getServerParameter('HTTP_USER_AGENT'));
  $client
    ->request('GET', 'https://www.example.com/https/www.example.com', array(), array(), array(
    'HTTP_HOST' => 'testhost',
    'HTTP_USER_AGENT' => 'testua',
    'HTTPS' => false,
    'NEW_SERVER_KEY' => 'new-server-key-value',
  ));
  $this
    ->assertEquals('localhost', $client
    ->getServerParameter('HTTP_HOST'));
  $this
    ->assertEquals('Symfony2 BrowserKit', $client
    ->getServerParameter('HTTP_USER_AGENT'));
  $this
    ->assertEquals('http://testhost/https/www.example.com', $client
    ->getRequest()
    ->getUri());
  $server = $client
    ->getRequest()
    ->getServer();
  $this
    ->assertArrayHasKey('HTTP_USER_AGENT', $server);
  $this
    ->assertEquals('testua', $server['HTTP_USER_AGENT']);
  $this
    ->assertArrayHasKey('HTTP_HOST', $server);
  $this
    ->assertEquals('testhost', $server['HTTP_HOST']);
  $this
    ->assertArrayHasKey('NEW_SERVER_KEY', $server);
  $this
    ->assertEquals('new-server-key-value', $server['NEW_SERVER_KEY']);
  $this
    ->assertArrayHasKey('HTTPS', $server);
  $this
    ->assertFalse($server['HTTPS']);
}