public function CacheableExceptionTest::testCacheableHttpException in Drupal 9
Same name and namespace in other branches
- 10 core/tests/Drupal/Tests/Core/Http/CacheableExceptionTest.php \Drupal\Tests\Core\Http\CacheableExceptionTest::testCacheableHttpException()
@covers \Drupal\Core\Http\Exception\CacheableHttpException
File
- core/
tests/ Drupal/ Tests/ Core/ Http/ CacheableExceptionTest.php, line 32
Class
- CacheableExceptionTest
- @group Http
Namespace
Drupal\Tests\Core\HttpCode
public function testCacheableHttpException() {
$exception = new CacheableHttpException((new CacheableMetadata())
->setCacheContexts([
'route',
]), 500, 'test message', NULL, [
'X-Drupal-Exception' => 'Test',
], 123);
$this
->assertSame([
'route',
], $exception
->getCacheContexts());
$this
->assertSame(500, $exception
->getStatusCode());
$this
->assertSame('test message', $exception
->getMessage());
$this
->assertSame([
'X-Drupal-Exception' => 'Test',
], $exception
->getHeaders());
$this
->assertSame(123, $exception
->getCode());
}