You are here

public function ClientTest::testRequestHttpHeaders 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::testRequestHttpHeaders()

File

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

Class

ClientTest

Namespace

Symfony\Component\BrowserKit\Tests

Code

public function testRequestHttpHeaders() {
  $client = new TestClient();
  $client
    ->request('GET', '/');
  $headers = $client
    ->getRequest()
    ->getServer();
  $this
    ->assertEquals('localhost', $headers['HTTP_HOST'], '->request() sets the HTTP_HOST header');
  $client = new TestClient();
  $client
    ->request('GET', 'http://www.example.com');
  $headers = $client
    ->getRequest()
    ->getServer();
  $this
    ->assertEquals('www.example.com', $headers['HTTP_HOST'], '->request() sets the HTTP_HOST header');
  $client
    ->request('GET', 'https://www.example.com');
  $headers = $client
    ->getRequest()
    ->getServer();
  $this
    ->assertTrue($headers['HTTPS'], '->request() sets the HTTPS header');
  $client = new TestClient();
  $client
    ->request('GET', 'http://www.example.com:8080');
  $headers = $client
    ->getRequest()
    ->getServer();
  $this
    ->assertEquals('www.example.com:8080', $headers['HTTP_HOST'], '->request() sets the HTTP_HOST header with port');
}