Commit 37df1bd0 authored by alexpott's avatar alexpott

Issue #2315489 by benjy: Renamed prepareIdMappings() in MigrateTestBase.

parent f8c9cf8b
......@@ -104,21 +104,20 @@ protected function loadDumps($files, $method = 'load') {
}
/**
* Prepare the id mappings.
* Prepare any dependent migrations.
*
* @param array $id_mappings
* A list of id mappings keyed by migration ids. Each id mapping is a list
* of two arrays, the first are source ids and the second are destination
* ids.
*/
protected function prepareIdMappings(array $id_mappings) {
protected function prepareMigrations(array $id_mappings) {
/** @var \Drupal\migrate\Entity\MigrationInterface[] $migrations */
$migrations = entity_load_multiple('migration', array_keys($id_mappings));
foreach ($id_mappings as $migration_id => $data) {
$migration = $migrations[$migration_id];
// @TODO, rename prepareIdMappings() in https://drupal.org/node/2315489
// which will make the position of this more appropriate.
// Mark the dependent migrations as complete.
$migration->setMigrationResult(MigrationInterface::RESULT_COMPLETED);
$id_map = $migration->getIdMap();
......
......@@ -32,7 +32,7 @@ public function setUp() {
array(array(5), array(5)),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$entity = entity_create('aggregator_feed', array(
'fid' => 5,
......
......@@ -27,7 +27,7 @@ class MigrateBlockContentTest extends MigrateDrupalTestBase {
*/
public function setUp() {
parent::setUp();
$this->prepareIdMappings(array(
$this->prepareMigrations(array(
'd6_filter_format' => array(
array(array(2), array('full_html'))
)
......
......@@ -46,7 +46,7 @@ public function setUp() {
$entity->enforceIsNew(TRUE);
$entity->save();
}
$this->prepareIdMappings(array(
$this->prepareMigrations(array(
'd6_custom_block' => array(
array(array(10), array(1)),
array(array(11), array(2)),
......
......@@ -35,7 +35,7 @@ protected function setUp() {
$entity->save();
$id_mappings['d6_node'][] = array(array($i), array($i));
}
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
// Load database dumps to provide source data.
$dumps = array(
$this->getDumpDirectory() . '/Drupal6Book.php',
......
......@@ -63,7 +63,7 @@ protected function setUp() {
array(array(1), array(1)),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$dumps = array(
$this->getDumpDirectory() . '/Drupal6NodeRevision.php',
);
......
......@@ -84,7 +84,7 @@ protected function setUp() {
array(array(2), array(2)),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$migrations = entity_load_multiple('migration', array('d6_cck_field_values:*'));
foreach ($migrations as $migration) {
......
......@@ -53,7 +53,7 @@ public function setUp() {
'd6_comment_entity_display' => array(array(array('story'), array('node', 'story', 'default', 'comment'))),
'd6_comment_entity_form_display' => array(array(array('story'), array('node', 'story', 'default', 'comment'))),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
\Drupal::service('comment.manager')->addDefaultField('node', 'story');
/** @var \Drupal\migrate\entity\Migration $migration */
......
......@@ -74,7 +74,7 @@ protected function setUp() {
array(array('page'), array('node', 'comment', 'page')),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', static::MIGRATION);
$this->prepare($migration, $this->dumps);
......
......@@ -42,7 +42,7 @@ public function setUp() {
array(array('comment'), array('comment_no_subject')),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_comment_entity_form_display_subject');
$dumps = array(
......
......@@ -40,7 +40,7 @@ public function setUp() {
array(array('comment'), array('comment_no_subject')),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_comment_field');
$dumps = array(
......
......@@ -33,7 +33,7 @@ public function setUp() {
array(array('page'), array('page')),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
foreach (array('page', 'story') as $type) {
entity_create('node_type', array('type' => $type))->save();
......
......@@ -40,7 +40,7 @@ public function setUp() {
array(array(2), array('some_other_category')),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$migration = entity_load('migration', 'd6_contact_settings');
$dumps = array(
$this->getDumpDirectory() . '/Drupal6ContactSettings.php',
......
......@@ -60,7 +60,7 @@ public function setUp() {
array(array('field_test_datetime'), array('node', 'field_test_datetime')),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$migration = entity_load('migration', 'd6_field_formatter_settings');
$dumps = array(
......
......@@ -60,7 +60,7 @@ public function setUp() {
array(array('test_page'), array('test_page')),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
entity_create('node_type', array('type' => 'page'))->save();
entity_create('node_type', array('type' => 'story'))->save();
entity_create('node_type', array('type' => 'test_page'))->save();
......
......@@ -60,7 +60,7 @@ public function setUp() {
array(array('field_test_datetime'), array('node', 'field_test_datetime')),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$migration = entity_load('migration', 'd6_field_instance_widget_settings');
$dumps = array(
$this->getDumpDirectory() . '/Drupal6FieldInstance.php',
......
......@@ -26,7 +26,7 @@ protected function setUp() {
array(array(1), array(1)),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$dumps = array(
$this->getDumpDirectory() . '/Drupal6NodeRevision.php',
......
......@@ -47,7 +47,7 @@ protected function setUp() {
),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$migration = entity_load('migration', 'd6_node_settings');
$migration->setMigrationResult(MigrationInterface::RESULT_COMPLETED);
......
......@@ -123,7 +123,7 @@ protected function setUp() {
array(array(15), array(15)),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
// Load database dumps to provide source data.
$dumps = array(
......
......@@ -25,7 +25,7 @@ class MigrateTaxonomyTermTest extends MigrateDrupalTestBase {
*/
protected function setUp() {
parent::setUp();
$this->prepareIdMappings(array(
$this->prepareMigrations(array(
'd6_taxonomy_vocabulary' => array(
array(array(1), array('vocabulary_1_i_0_')),
array(array(2), array('vocabulary_2_i_1_')),
......
......@@ -29,7 +29,7 @@ protected function setUp() {
array(array(2), array(2)),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
/** @var \Drupal\migrate\entity\Migration $migration */
$migrations = entity_load_multiple('migration', array('d6_term_node_revision:*'));
foreach ($migrations as $migration) {
......
......@@ -67,7 +67,7 @@ protected function setUp() {
array(array(2), array(2)),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$vids = array(1, 2, 3);
for ($i = 1; $i <= 2; $i++) {
......
......@@ -67,7 +67,7 @@ public function setUp() {
array(array(1), array(1)),
array(array(2), array(2)),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$vids = array(1, 2, 3);
for ($i = 1; $i <= 2; $i++) {
$node = entity_create('node', array(
......
......@@ -39,7 +39,7 @@ protected function setUp() {
array(array(1), array('node', 'page', 'upload')),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$migration = entity_load('migration', 'd6_upload_entity_display');
$dumps = array(
......
......@@ -39,7 +39,7 @@ protected function setUp() {
array(array(1), array('node', 'page', 'upload')),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$migration = entity_load('migration', 'd6_upload_entity_form_display');
$dumps = array(
......
......@@ -39,7 +39,7 @@ protected function setUp() {
array(array('story'), array('story')),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
foreach (array('page', 'story') as $type) {
entity_create('node_type', array('type' => $type))->save();
......
......@@ -35,7 +35,7 @@ public function setUp() {
array(array(1), array('user', 'user', 'user_picture')),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$migration = entity_load('migration', 'd6_user_picture_entity_display');
$executable = new MigrateExecutable($migration, $this);
......
......@@ -34,7 +34,7 @@ public function setUp() {
array(array(1), array('user', 'user', 'user_picture')),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$migration = entity_load('migration', 'd6_user_picture_entity_form_display');
$executable = new MigrateExecutable($migration, $this);
......
......@@ -35,7 +35,7 @@ public function setUp() {
array(array('user_upload'), array('name', 'bundle')),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
entity_create('field_storage_config', array(
'entity_type' => 'user',
'name' => 'user_picture',
......
......@@ -30,7 +30,7 @@ protected function setUp() {
array(array(1), array('user', 'profile_color')),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$this->createFields();
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_user_profile_field_instance');
......
......@@ -36,7 +36,7 @@ public function setUp() {
array(array(2), array('full_html'))
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
/** @var \Drupal\migrate\entity\Migration $migration */
$migration = entity_load('migration', 'd6_user_role');
......
......@@ -115,7 +115,7 @@ protected function setUp() {
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
// Migrate users.
$migration = entity_load('migration', 'd6_user');
......
......@@ -57,7 +57,7 @@ protected function setUp() {
array(array(4, 'page'), array('node', 'page', 'tags')),
)
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$migration = entity_load('migration', 'd6_vocabulary_entity_display');
$dumps = array(
......
......@@ -57,7 +57,7 @@ protected function setUp() {
array(array(4, 'page'), array('node', 'page', 'tags')),
)
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
$migration = entity_load('migration', 'd6_vocabulary_entity_form_display');
$dumps = array(
......
......@@ -44,7 +44,7 @@ protected function setUp() {
array(array(4), array('node', 'tags')),
)
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
// Create the vocab.
entity_create('taxonomy_vocabulary', array(
......
......@@ -36,7 +36,7 @@ protected function setUp() {
array(array(4), array('tags')),
),
);
$this->prepareIdMappings($id_mappings);
$this->prepareMigrations($id_mappings);
entity_create('taxonomy_vocabulary', array(
'name' => 'Test Vocabulary',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment