function 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());
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
