You are here

protected function RouteNormalizerRequestSubscriberTest::getSubscriber in Redirect 8

Create a RouteNormalizerRequestSubscriber object.

Parameters

string $request_uri: The return value for the generateFromRoute method.

bool $enabled: Flag indicating if the normalizer shoud be enabled.

bool $call_expected: If true, canRedirect() and other methods should be called once.

Return value

\Drupal\redirect\EventSubscriber\RouteNormalizerRequestSubscriber

4 calls to RouteNormalizerRequestSubscriberTest::getSubscriber()
RouteNormalizerRequestSubscriberTest::testOnKernelRequestRedirect in tests/src/Unit/RouteNormalizerRequestSubscriberTest.php
@covers ::onKernelRequestRedirect @dataProvider getTestUrls
RouteNormalizerRequestSubscriberTest::testSkipIfFlagNotEnabled in tests/src/Unit/RouteNormalizerRequestSubscriberTest.php
@covers ::onKernelRequestRedirect
RouteNormalizerRequestSubscriberTest::testSkipIfRequestAttribute in tests/src/Unit/RouteNormalizerRequestSubscriberTest.php
@covers ::onKernelRequestRedirect
RouteNormalizerRequestSubscriberTest::testSkipIfSubRequest in tests/src/Unit/RouteNormalizerRequestSubscriberTest.php
@covers ::onKernelRequestRedirect

File

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

Class

RouteNormalizerRequestSubscriberTest
Tests the route normalizer.

Namespace

Drupal\Tests\redirect\Unit

Code

protected function getSubscriber($request_uri, $enabled = TRUE, $call_expected = TRUE) {
  return new RouteNormalizerRequestSubscriber($this
    ->getUrlGeneratorStub($request_uri, $call_expected), $this
    ->getPathMatcherStub($call_expected), $this
    ->getConfigFactoryStub([
    'redirect.settings' => [
      'route_normalizer_enabled' => $enabled,
      'default_status_code' => 301,
    ],
  ]), $this
    ->getRedirectCheckerStub($call_expected));
}