You are here

public function FlattenExceptionTest::testHeadersForHttpException in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php \Symfony\Component\Debug\Tests\Exception\FlattenExceptionTest::testHeadersForHttpException()

File

vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php, line 83

Class

FlattenExceptionTest

Namespace

Symfony\Component\Debug\Tests\Exception

Code

public function testHeadersForHttpException() {
  $flattened = FlattenException::create(new MethodNotAllowedHttpException(array(
    'POST',
  )));
  $this
    ->assertEquals(array(
    'Allow' => 'POST',
  ), $flattened
    ->getHeaders());
  $flattened = FlattenException::create(new UnauthorizedHttpException('Basic realm="My Realm"'));
  $this
    ->assertEquals(array(
    'WWW-Authenticate' => 'Basic realm="My Realm"',
  ), $flattened
    ->getHeaders());
  $flattened = FlattenException::create(new ServiceUnavailableHttpException('Fri, 31 Dec 1999 23:59:59 GMT'));
  $this
    ->assertEquals(array(
    'Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT',
  ), $flattened
    ->getHeaders());
  $flattened = FlattenException::create(new ServiceUnavailableHttpException(120));
  $this
    ->assertEquals(array(
    'Retry-After' => 120,
  ), $flattened
    ->getHeaders());
  $flattened = FlattenException::create(new TooManyRequestsHttpException('Fri, 31 Dec 1999 23:59:59 GMT'));
  $this
    ->assertEquals(array(
    'Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT',
  ), $flattened
    ->getHeaders());
  $flattened = FlattenException::create(new TooManyRequestsHttpException(120));
  $this
    ->assertEquals(array(
    'Retry-After' => 120,
  ), $flattened
    ->getHeaders());
}