function IsFrontPathCacheContextTest::createPathMatcher

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Cache/Context/IsFrontPathCacheContextTest.php \Drupal\Tests\Core\Cache\Context\IsFrontPathCacheContextTest::createPathMatcher()
  2. 8.9.x core/tests/Drupal/Tests/Core/Cache/Context/IsFrontPathCacheContextTest.php \Drupal\Tests\Core\Cache\Context\IsFrontPathCacheContextTest::createPathMatcher()
  3. 10 core/tests/Drupal/Tests/Core/Cache/Context/IsFrontPathCacheContextTest.php \Drupal\Tests\Core\Cache\Context\IsFrontPathCacheContextTest::createPathMatcher()

Creates a PathMatcherInterface prophecy.

Parameters

bool $is_front: Whether the page is the front page.

Return value

\Prophecy\Prophecy\ObjectProphecy

File

core/tests/Drupal/Tests/Core/Cache/Context/IsFrontPathCacheContextTest.php, line 41

Class

IsFrontPathCacheContextTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Cache%21Context%21IsFrontPathCacheContext.php/class/IsFrontPathCacheContext/11.x" title="Defines a cache context for whether the URL is the front page of the site." class="local">\Drupal\Core\Cache\Context\IsFrontPathCacheContext</a> @group Cache

Namespace

Drupal\Tests\Core\Cache\Context

Code

protected function createPathMatcher($is_front) {
    $path_matcher = $this->prophesize(PathMatcherInterface::class);
    $path_matcher->isFrontPage()
        ->willReturn($is_front);
    return $path_matcher;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.