You are here

public function AliasManagerTest::testGetAliasByPathWhitelist in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php \Drupal\Tests\Core\Path\AliasManagerTest::testGetAliasByPathWhitelist()

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

@covers ::getAliasByPath

File

core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php, line 159
Contains \Drupal\Tests\Core\Path\AliasManagerTest.

Class

AliasManagerTest
@coversDefaultClass \Drupal\Core\Path\AliasManager @group Path

Namespace

Drupal\Tests\Core\Path

Code

public function testGetAliasByPathWhitelist() {
  $path_part1 = $this
    ->randomMachineName();
  $path_part2 = $this
    ->randomMachineName();
  $path = '/' . $path_part1 . '/' . $path_part2;
  $this
    ->setUpCurrentLanguage();
  $this->aliasWhitelist
    ->expects($this
    ->any())
    ->method('get')
    ->with($path_part1)
    ->will($this
    ->returnValue(FALSE));

  // The whitelist returns FALSE for that path part, so the storage should
  // never be called.
  $this->aliasStorage
    ->expects($this
    ->never())
    ->method('lookupPathAlias');
  $this
    ->assertEquals($path, $this->aliasManager
    ->getAliasByPath($path));
}