$aliasManager->
cacheClear();
$this->
assertEquals('/user/2',
$aliasManager->
getPathByAlias('/bar'
), 'Newer alias record is returned when comparing two LanguageInterface::LANGCODE_NOT_SPECIFIED paths with the same alias.'
);
} /**
* Tests the alias whitelist.
*/
public function testWhitelist() { $memoryCounterBackend =
new MemoryCounterBackend();
// Create AliasManager and Path object.
$whitelist =
new AliasWhitelist('path_alias_whitelist',
$memoryCounterBackend,
$this->container->
get('lock'
),
$this->container->
get('state'
),
$this->container->
get('path_alias.repository'
));
$aliasManager =
new AliasManager($this->container->
get('path_alias.repository'
),
$whitelist,
$this->container->
get('language_manager'
),
$memoryCounterBackend);
// No alias for user and admin yet, so should be NULL.
$this->
assertNull($whitelist->
get('user'
));
$this->
assertNull($whitelist->
get('admin'
));
// Non-existing path roots should be NULL too. Use a length of 7 to avoid
// possible conflict with random aliases below.
$this->
assertNull($whitelist->
get($this->
randomMachineName()));
// Add an alias for user/1, user should get whitelisted now.