function AliasManagerTest::testGetAliasByPathPrefixList

Tests the getAliasByPath method for a path that is not in the prefix list.

@legacy-covers ::getAliasByPath

File

core/modules/path_alias/tests/src/Unit/AliasManagerTest.php, line 160

Class

AliasManagerTest
Tests Drupal\path_alias\AliasManager.

Namespace

Drupal\Tests\path_alias\Unit

Code

public function testGetAliasByPathPrefixList() {
  $path_part1 = $this->randomMachineName();
  $path_part2 = $this->randomMachineName();
  $path = '/' . $path_part1 . '/' . $path_part2;
  $this->setUpCurrentLanguage();
  $this->aliasPrefixList
    ->expects($this->any())
    ->method('get')
    ->with($path_part1)
    ->willReturn(FALSE);
  // The prefix list returns FALSE for that path part, so the storage should
  // never be called.
  $this->aliasRepository
    ->expects($this->never())
    ->method('lookupBySystemPath');
  $this->assertEquals($path, $this->aliasManager
    ->getAliasByPath($path));
}

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