function AliasManagerTest::testGetAliasByPathNoMatch
Same name and namespace in other branches
- 10 core/modules/path_alias/tests/src/Unit/AliasManagerTest.php \Drupal\Tests\path_alias\Unit\AliasManagerTest::testGetAliasByPathNoMatch()
- 9 core/modules/path_alias/tests/src/Unit/AliasManagerTest.php \Drupal\Tests\path_alias\Unit\AliasManagerTest::testGetAliasByPathNoMatch()
- 8.9.x core/modules/path_alias/tests/src/Unit/AliasManagerTest.php \Drupal\Tests\path_alias\Unit\AliasManagerTest::testGetAliasByPathNoMatch()
Tests the getAliasByPath method for a path that has no matching alias.
File
-
core/
modules/ path_alias/ tests/ src/ Unit/ AliasManagerTest.php, line 175
Class
Namespace
Drupal\Tests\path_alias\UnitCode
public function testGetAliasByPathNoMatch() : void {
$path_part1 = $this->randomMachineName();
$path_part2 = $this->randomMachineName();
$path = '/' . $path_part1 . '/' . $path_part2;
$language = $this->setUpCurrentLanguage();
$this->aliasPrefixList
->expects($this->any())
->method('get')
->with($path_part1)
->willReturn(TRUE);
$this->aliasRepository
->expects($this->once())
->method('preloadPathAlias')
->with([
$path => $path,
], $language->getId())
->willReturn([]);
$this->assertEquals($path, $this->aliasManager
->getAliasByPath($path));
// Call it twice to test the static cache.
$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.