You are here

public function PathMatcherTest::testMatchAliasMatched in Acquia Lift Connector 8

Tests the match() method - path's alias is matched.

@covers ::match

File

tests/src/Unit/Service/Helper/PathMatcherTest.php, line 82
Contains \Drupal\Tests\acquia_lift\Service\Helper\PathMatcherTest.

Class

PathMatcherTest
PathMatcher Test.

Namespace

Drupal\Tests\acquia_lift\Service\Helper

Code

public function testMatchAliasMatched() {
  $this->basePathMatcher
    ->expects($this
    ->at(0))
    ->method('matchPath')
    ->with('a_path', 'a_pattern')
    ->willReturn(FALSE);
  $this->aliasManager
    ->expects($this
    ->once())
    ->method('getAliasByPath')
    ->with('a_path')
    ->willReturn('AN_ALIAS');
  $this->basePathMatcher
    ->expects($this
    ->at(1))
    ->method('matchPath')
    ->with('an_alias', 'a_pattern')
    ->willReturn(TRUE);
  $pathMatcher = new PathMatcher($this->aliasManager, $this->basePathMatcher);
  $is_matched = $pathMatcher
    ->match('A_PATH', 'A_PATTERN');
  $this
    ->assertTrue($is_matched);
}