You are here

public function RouteNormalizerRequestSubscriberTest::testSkipIfSubRequest in Redirect 8

@covers ::onKernelRequestRedirect

File

tests/src/Unit/RouteNormalizerRequestSubscriberTest.php, line 54

Class

RouteNormalizerRequestSubscriberTest
Tests the route normalizer.

Namespace

Drupal\Tests\redirect\Unit

Code

public function testSkipIfSubRequest() {
  $request_uri = 'https://example.com/route-to-normalize';
  $request_query = [];
  $event = $this
    ->getGetResponseEventStub($request_uri, http_build_query($request_query), HttpKernelInterface::SUB_REQUEST);

  // We are using SUB_REQUEST as the request type and expect to leave onKernelRequestRedirect at the beginning,
  // i.e. $this->redirectChecker->canRedirect($request) should never be called.
  $subscriber = $this
    ->getSubscriber($request_uri, TRUE, FALSE);
  $subscriber
    ->onKernelRequestRedirect($event);
}