function MigrateDependenciesTest::testMigrateDependenciesOrder
Tests that the order is correct when loading several migrations.
@group legacy @expectedDeprecation \Drupal\migrate\Plugin\Migration::get() is deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.x. Use more specific getters instead. See https://www.drupal.org/node/2873795
File
-
core/
modules/ migrate_drupal/ tests/ src/ Kernel/ dependencies/ MigrateDependenciesTest.php, line 28
Class
- MigrateDependenciesTest
- Ensure the consistency among the dependencies for migrate.
Namespace
Drupal\Tests\migrate_drupal\Kernel\dependenciesCode
public function testMigrateDependenciesOrder() {
$migration_items = [
'd6_comment',
'd6_filter_format',
'd6_node:page',
];
$migrations = $this->container
->get('plugin.manager.migration')
->createInstances($migration_items);
$expected_order = [
'd6_filter_format',
'd6_node:page',
'd6_comment',
];
$this->assertIdentical(array_keys($migrations), $expected_order);
$expected_requirements = [
// d6_comment depends on d6_node:*, which the deriver expands into every
// variant of d6_node.
'd6_node:article',
'd6_node:company',
'd6_node:employee',
'd6_node:event',
'd6_node:forum',
'd6_node:page',
'd6_user',
'd6_node_type',
'd6_node_settings',
'd6_filter_format',
'd6_node:sponsor',
'd6_node:story',
'd6_node:test_event',
'd6_node:test_page',
'd6_node:test_planet',
'd6_node:test_story',
'd6_comment_type',
'd6_comment_entity_display',
'd6_comment_entity_form_display',
];
// Migration dependencies for comment include dependencies for node
// migration as well.
$actual_requirements = $migrations['d6_comment']->get('requirements');
$this->assertIdentical(count($actual_requirements), count($expected_requirements));
foreach ($expected_requirements as $requirement) {
$this->assertIdentical($actual_requirements[$requirement], $requirement);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.