You are here

public function RouteNormalizerRequestSubscriberTest::testSkipIfFlagNotEnabled in Redirect 8

@covers ::onKernelRequestRedirect

File

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

Class

RouteNormalizerRequestSubscriberTest
Tests the route normalizer.

Namespace

Drupal\Tests\redirect\Unit

Code

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

  // We set 'route_normalizer_enabled' config to FALSE and expect to leave onKernelRequestRedirect at the beginning,
  // i.e. $this->redirectChecker->canRedirect($request) should never be called.
  $subscriber = $this
    ->getSubscriber($request_uri, FALSE, FALSE);
  $subscriber
    ->onKernelRequestRedirect($event);
}