class MigrateUrlAliasTest
Same name in this branch
- 9 core/modules/path/tests/src/Kernel/Migrate/d6/MigrateUrlAliasTest.php \Drupal\Tests\path\Kernel\Migrate\d6\MigrateUrlAliasTest
Same name and namespace in other branches
- 11.x core/modules/path/tests/src/Kernel/Migrate/d6/MigrateUrlAliasTest.php \Drupal\Tests\path\Kernel\Migrate\d6\MigrateUrlAliasTest
- 11.x core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTest.php \Drupal\Tests\path\Kernel\Migrate\d7\MigrateUrlAliasTest
- 10 core/modules/path/tests/src/Kernel/Migrate/d6/MigrateUrlAliasTest.php \Drupal\Tests\path\Kernel\Migrate\d6\MigrateUrlAliasTest
- 10 core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTest.php \Drupal\Tests\path\Kernel\Migrate\d7\MigrateUrlAliasTest
Tests URL alias migration.
@group path
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase extends \Drupal\migrate\MigrateMessageInterface implements \Drupal\KernelTests\KernelTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase implements \Drupal\Tests\migrate\Kernel\MigrateTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase uses \Drupal\Tests\migrate_drupal\Traits\NodeMigrateTypeTestTrait implements \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase
- class \Drupal\Tests\path\Kernel\Migrate\d7\MigrateUrlAliasTestBase uses \Drupal\Tests\Traits\Core\PathAliasTestTrait implements \Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase
- class \Drupal\Tests\path\Kernel\Migrate\d7\MigrateUrlAliasTest implements \Drupal\Tests\path\Kernel\Migrate\d7\MigrateUrlAliasTestBase
- class \Drupal\Tests\path\Kernel\Migrate\d7\MigrateUrlAliasTestBase uses \Drupal\Tests\Traits\Core\PathAliasTestTrait implements \Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase
- class \Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase uses \Drupal\Tests\migrate_drupal\Traits\NodeMigrateTypeTestTrait implements \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase implements \Drupal\Tests\migrate\Kernel\MigrateTestBase
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase extends \Drupal\migrate\MigrateMessageInterface implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of MigrateUrlAliasTest
File
-
core/
modules/ path/ tests/ src/ Kernel/ Migrate/ d7/ MigrateUrlAliasTest.php, line 10
Namespace
Drupal\Tests\path\Kernel\Migrate\d7View source
class MigrateUrlAliasTest extends MigrateUrlAliasTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'path_alias',
'content_translation',
];
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->executeMigrations([
'd7_node_translation',
'd7_url_alias',
]);
}
/**
* Tests the URL alias migration with translated nodes.
*/
public function testUrlAliasWithTranslatedNodes() {
// Alias for the 'The thing about Deep Space 9' node in English.
$path_alias = $this->loadPathAliasByConditions([
'alias' => '/deep-space-9',
]);
$this->assertSame('/node/2', $path_alias->getPath());
$this->assertSame('en', $path_alias->get('langcode')->value);
// Alias for the 'The thing about Deep Space 9' Icelandic translation,
// which should now point to node/2 instead of node/3.
$path_alias = $this->loadPathAliasByConditions([
'alias' => '/deep-space-9-is',
]);
$this->assertSame('/node/2', $path_alias->getPath());
$this->assertSame('is', $path_alias->get('langcode')->value);
// Alias for the 'The thing about Firefly' node in Icelandic.
$path_alias = $this->loadPathAliasByConditions([
'alias' => '/firefly-is',
]);
$this->assertSame('/node/4', $path_alias->getPath());
$this->assertSame('is', $path_alias->get('langcode')->value);
// Alias for the 'The thing about Firefly' English translation,
// which should now point to node/4 instead of node/5.
$path_alias = $this->loadPathAliasByConditions([
'alias' => '/firefly',
]);
$this->assertSame('/node/4', $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.