public function LanguageNeutralAliasesTest::testLookupByAlias in Language neutral aliases 8.2
Same name and namespace in other branches
- 3.x tests/src/Kernel/LanguageNeutralAliasesTest.php \Drupal\Tests\language_neutral_aliases\Kernel\LanguageNeutralAliasesTest::testLookupByAlias()
Test that lookupByAlias() only returns language neutral aliases.
File
- tests/
src/ Kernel/ LanguageNeutralAliasesTest.php, line 184
Class
- LanguageNeutralAliasesTest
- Test language neutral aliases.
Namespace
Drupal\Tests\language_neutral_aliases\KernelCode
public function testLookupByAlias() {
$repository = $this->container
->get('path_alias.repository');
$this
->assertEqual([
'id' => 3,
'path' => '/node/3',
'alias' => '/path/third',
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
], $repository
->lookupByAlias('/path/third', LanguageInterface::LANGCODE_NOT_SPECIFIED));
$this
->assertEqual([
'id' => 3,
'path' => '/node/3',
'alias' => '/path/third',
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
], $repository
->lookupByAlias('/path/third', 'de'));
$this
->assertNull($repository
->lookupByAlias('/path/first', LanguageInterface::LANGCODE_NOT_SPECIFIED));
$this
->assertNull($repository
->lookupByAlias('/path/first', 'de'));
}