You are here

protected function RouteNormalizerRequestSubscriberTest::getRedirectCheckerStub in Redirect 8

Gets the RedirectChecker mock object.

Parameters

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

Return value

\Drupal\redirect\RedirectChecker|\PHPUnit\Framework\MockObject\MockObject

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

File

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

Class

RouteNormalizerRequestSubscriberTest
Tests the route normalizer.

Namespace

Drupal\Tests\redirect\Unit

Code

protected function getRedirectCheckerStub($call_expected = TRUE) {
  $redirect_checker = $this
    ->getMockBuilder('\\Drupal\\redirect\\RedirectChecker')
    ->disableOriginalConstructor()
    ->getMock();
  $expectation = $call_expected ? $this
    ->once() : $this
    ->never();
  $redirect_checker
    ->expects($expectation)
    ->method('canRedirect')
    ->withAnyParameters()
    ->willReturn(TRUE);
  return $redirect_checker;
}