public function ExceptionJsonSubscriberTest::providerTestOn4xx in Drupal 8        
                          
                  
                        Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/EventSubscriber/ExceptionJsonSubscriberTest.php \Drupal\Tests\Core\EventSubscriber\ExceptionJsonSubscriberTest::providerTestOn4xx()
File
 
   - core/tests/Drupal/Tests/Core/EventSubscriber/ExceptionJsonSubscriberTest.php, line 42
Class
  
  - ExceptionJsonSubscriberTest 
- @coversDefaultClass \Drupal\Core\EventSubscriber\ExceptionJsonSubscriber
@group EventSubscriber
Namespace
  Drupal\Tests\Core\EventSubscriber
Code
public function providerTestOn4xx() {
  return [
    'uncacheable exception' => [
      new MethodNotAllowedHttpException([
        'POST',
        'PUT',
      ], 'test message'),
      JsonResponse::class,
    ],
    'cacheable exception' => [
      new CacheableMethodNotAllowedHttpException((new CacheableMetadata())
        ->setCacheContexts([
        'route',
      ]), [
        'POST',
        'PUT',
      ], 'test message'),
      CacheableJsonResponse::class,
    ],
  ];
}