You are here

public function R4032LoginSubscriberTest::providerInvalidExceptions in Redirect 403 to User Login 8

Provides predefined and SPL exception events to ::on403().

Return value

array An array of GetResponseForExceptionEvent exception events.

File

tests/src/Unit/R4032LoginSubscriberTest.php, line 255

Class

R4032LoginSubscriberTest
@coversDefaultClass \Drupal\r4032login\EventSubscriber\R4032LoginSubscriber @group r4032login

Namespace

Drupal\Tests\r4032login\Unit

Code

public function providerInvalidExceptions() {
  $kernel = $this
    ->getMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface');
  $exceptions = [];
  foreach (get_declared_classes() as $name) {
    $class = new \ReflectionClass($name);
    if ($class
      ->isSubclassOf('Exception')) {
      $exceptions[] = [
        new GetResponseForExceptionEvent($kernel, new Request(), HttpKernelInterface::MASTER_REQUEST, $this
          ->getMockBuilder($name)
          ->disableOriginalConstructor()
          ->getMock()),
      ];
    }
  }
  return $exceptions;
}