// Remove the English aliases, which should cause a fallback to the most
// recently created language-neutral alias, 'bar'.
$path_alias_storage =
$this->container->
get('entity_type.manager'
)->
getStorage('path_alias'
);
$entities =
$path_alias_storage->
loadByProperties(['langcode' => 'en'
]);
$path_alias_storage->
delete($entities);
$this->
assertEquals('/bar',
$aliasManager->
getAliasByPath($path_alias->
getPath()), 'Path lookup falls back to recently created language-neutral alias.'
);
// Test the situation where the alias and language are the same, but
// the source differs. The newer alias record should be returned.
$this->
createPathAlias('/user/2', '/bar'
);
$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'
));