You are here

protected function RouteNormalizerRequestSubscriberTest::getPathMatcherStub in Redirect 8

Gets the PathMatcher mock object.

Parameters

bool $call_expected: If true, we expect isFrontPage() to be called once.

Return value

\Drupal\Core\Path\PathMatcherInterface|\PHPUnit\Framework\MockObject\MockObject

1 call to RouteNormalizerRequestSubscriberTest::getPathMatcherStub()
RouteNormalizerRequestSubscriberTest::getSubscriber in tests/src/Unit/RouteNormalizerRequestSubscriberTest.php
Create a RouteNormalizerRequestSubscriber object.

File

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

Class

RouteNormalizerRequestSubscriberTest
Tests the route normalizer.

Namespace

Drupal\Tests\redirect\Unit

Code

protected function getPathMatcherStub($call_expected = TRUE) {
  $path_matcher = $this
    ->getMockBuilder('\\Drupal\\Core\\Path\\PathMatcherInterface')
    ->getMock();
  $expectation = $call_expected ? $this
    ->once() : $this
    ->never();
  $path_matcher
    ->expects($expectation)
    ->method('isFrontPage')
    ->withAnyParameters()
    ->willReturn(FALSE);
  return $path_matcher;
}