function MigrateUrlAliasTest::testUrlAliasWithTranslatedNodes
Test the URL alias migration with translated nodes.
File
-
core/
modules/ path/ tests/ src/ Kernel/ Migrate/ d6/ MigrateUrlAliasTest.php, line 130
Class
- MigrateUrlAliasTest
- URL alias migration.
Namespace
Drupal\Tests\path\Kernel\Migrate\d6Code
public function testUrlAliasWithTranslatedNodes() {
// Alias for the 'The Real McCoy' node in English.
$path_alias = $this->loadPathAliasByConditions([
'alias' => '/the-real-mccoy',
]);
$this->assertSame('/node/10', $path_alias->getPath());
$this->assertSame('en', $path_alias->get('langcode')->value);
// Alias for the 'The Real McCoy' French translation,
// which should now point to node/10 instead of node/11.
$path_alias = $this->loadPathAliasByConditions([
'alias' => '/le-vrai-mccoy',
]);
$this->assertSame('/node/10', $path_alias->getPath());
$this->assertSame('fr', $path_alias->get('langcode')->value);
// Alias for the 'Abantu zulu' node in Zulu.
$path_alias = $this->loadPathAliasByConditions([
'alias' => '/abantu-zulu',
]);
$this->assertSame('/node/12', $path_alias->getPath());
$this->assertSame('zu', $path_alias->get('langcode')->value);
// Alias for the 'Abantu zulu' English translation,
// which should now point to node/12 instead of node/13.
$path_alias = $this->loadPathAliasByConditions([
'alias' => '/the-zulu-people',
]);
$this->assertSame('/node/12', $path_alias->getPath());
$this->assertSame('en', $path_alias->get('langcode')->value);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.