public function AliasManagerTest::testGetPathByAliasMatch in Drupal 8
Same name and namespace in other branches
- 9 core/modules/path_alias/tests/src/Unit/AliasManagerTest.php \Drupal\Tests\path_alias\Unit\AliasManagerTest::testGetPathByAliasMatch()
- 10 core/modules/path_alias/tests/src/Unit/AliasManagerTest.php \Drupal\Tests\path_alias\Unit\AliasManagerTest::testGetPathByAliasMatch()
Tests the getPathByAlias method for an alias that have a matching path.
@covers ::getPathByAlias
File
- core/
modules/ path_alias/ tests/ src/ Unit/ AliasManagerTest.php, line 118
Class
- AliasManagerTest
- @coversDefaultClass \Drupal\path_alias\AliasManager @group path_alias
Namespace
Drupal\Tests\path_alias\UnitCode
public function testGetPathByAliasMatch() {
$alias = $this
->randomMachineName();
$path = $this
->randomMachineName();
$language = $this
->setUpCurrentLanguage();
$this->aliasRepository
->expects($this
->once())
->method('lookupByAlias')
->with($alias, $language
->getId())
->will($this
->returnValue([
'path' => $path,
]));
$this
->assertEquals($path, $this->aliasManager
->getPathByAlias($alias));
// Call it twice to test the static cache.
$this
->assertEquals($path, $this->aliasManager
->getPathByAlias($alias));
}