You are here

public function ServerBagTest::testShouldExtractHeadersFromServerArray in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-foundation/Tests/ServerBagTest.php \Symfony\Component\HttpFoundation\Tests\ServerBagTest::testShouldExtractHeadersFromServerArray()

File

vendor/symfony/http-foundation/Tests/ServerBagTest.php, line 23

Class

ServerBagTest
ServerBagTest.

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testShouldExtractHeadersFromServerArray() {
  $server = array(
    'SOME_SERVER_VARIABLE' => 'value',
    'SOME_SERVER_VARIABLE2' => 'value',
    'ROOT' => 'value',
    'HTTP_CONTENT_TYPE' => 'text/html',
    'HTTP_CONTENT_LENGTH' => '0',
    'HTTP_ETAG' => 'asdf',
    'PHP_AUTH_USER' => 'foo',
    'PHP_AUTH_PW' => 'bar',
  );
  $bag = new ServerBag($server);
  $this
    ->assertEquals(array(
    'CONTENT_TYPE' => 'text/html',
    'CONTENT_LENGTH' => '0',
    'ETAG' => 'asdf',
    'AUTHORIZATION' => 'Basic ' . base64_encode('foo:bar'),
    'PHP_AUTH_USER' => 'foo',
    'PHP_AUTH_PW' => 'bar',
  ), $bag
    ->getHeaders());
}