public function FlattenExceptionTest::testStatusCode in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php \Symfony\Component\Debug\Tests\Exception\FlattenExceptionTest::testStatusCode()
File
- vendor/
symfony/ debug/ Tests/ Exception/ FlattenExceptionTest.php, line 32
Class
Namespace
Symfony\Component\Debug\Tests\ExceptionCode
public function testStatusCode() {
$flattened = FlattenException::create(new \RuntimeException(), 403);
$this
->assertEquals('403', $flattened
->getStatusCode());
$flattened = FlattenException::create(new \RuntimeException());
$this
->assertEquals('500', $flattened
->getStatusCode());
$flattened = FlattenException::create(new NotFoundHttpException());
$this
->assertEquals('404', $flattened
->getStatusCode());
$flattened = FlattenException::create(new UnauthorizedHttpException('Basic realm="My Realm"'));
$this
->assertEquals('401', $flattened
->getStatusCode());
$flattened = FlattenException::create(new BadRequestHttpException());
$this
->assertEquals('400', $flattened
->getStatusCode());
$flattened = FlattenException::create(new NotAcceptableHttpException());
$this
->assertEquals('406', $flattened
->getStatusCode());
$flattened = FlattenException::create(new ConflictHttpException());
$this
->assertEquals('409', $flattened
->getStatusCode());
$flattened = FlattenException::create(new MethodNotAllowedHttpException(array(
'POST',
)));
$this
->assertEquals('405', $flattened
->getStatusCode());
$flattened = FlattenException::create(new AccessDeniedHttpException());
$this
->assertEquals('403', $flattened
->getStatusCode());
$flattened = FlattenException::create(new GoneHttpException());
$this
->assertEquals('410', $flattened
->getStatusCode());
$flattened = FlattenException::create(new LengthRequiredHttpException());
$this
->assertEquals('411', $flattened
->getStatusCode());
$flattened = FlattenException::create(new PreconditionFailedHttpException());
$this
->assertEquals('412', $flattened
->getStatusCode());
$flattened = FlattenException::create(new PreconditionRequiredHttpException());
$this
->assertEquals('428', $flattened
->getStatusCode());
$flattened = FlattenException::create(new ServiceUnavailableHttpException());
$this
->assertEquals('503', $flattened
->getStatusCode());
$flattened = FlattenException::create(new TooManyRequestsHttpException());
$this
->assertEquals('429', $flattened
->getStatusCode());
$flattened = FlattenException::create(new UnsupportedMediaTypeHttpException());
$this
->assertEquals('415', $flattened
->getStatusCode());
}