You are here

public function RouteNormalizerRequestSubscriberTest::testOnKernelRequestRedirect in Redirect 8

@covers ::onKernelRequestRedirect @dataProvider getTestUrls

File

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

Class

RouteNormalizerRequestSubscriberTest
Tests the route normalizer.

Namespace

Drupal\Tests\redirect\Unit

Code

public function testOnKernelRequestRedirect($request_uri, $request_query, $expected, $expect_normalization) {
  $event = $this
    ->getGetResponseEventStub($request_uri, http_build_query($request_query));
  $subscriber = $this
    ->getSubscriber($request_uri);
  $subscriber
    ->onKernelRequestRedirect($event);
  if ($expect_normalization) {
    $response = $event
      ->getResponse();
    $this
      ->assertEquals($expected, $response
      ->getTargetUrl());
  }
}