Skip to content
Snippets Groups Projects
Commit 699606e6 authored by Gabor Hojtsy's avatar Gabor Hojtsy
Browse files

Issue #2597680 by stimalsina, neclimdul, paryank, Derimagia, timodwhit, Dries,...

Issue #2597680 by stimalsina, neclimdul, paryank, Derimagia, timodwhit, Dries, vinothg, heddn, benjy, effulgentsia: Some migrations have warnings when node types don't exist
parent 469003db
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Showing
with 177 additions and 13 deletions
......@@ -14,7 +14,14 @@ source:
settings: {}
process:
entity_type: 'constants/entity_type'
bundle: node_type
bundle:
-
plugin: migration_lookup
migration: d6_node_type
source: node_type
-
plugin: skip_on_empty
method: row
view_mode: 'constants/view_mode'
field_name: 'constants/name'
type: 'constants/type'
......
......@@ -15,7 +15,14 @@ source:
progress_indicator: throbber
process:
entity_type: 'constants/entity_type'
bundle: node_type
bundle:
-
plugin: migration_lookup
migration: d6_node_type
source: node_type
-
plugin: skip_on_empty
method: row
field_name: 'constants/name'
form_mode: 'constants/form_mode'
type: 'constants/type'
......
......@@ -23,13 +23,14 @@ class MigrateUploadEntityDisplayTest extends MigrateDrupal6TestBase {
protected function setUp() {
parent::setUp();
$this->migrateFields();
$this->executeMigration('d6_upload_entity_display');
}
/**
* Tests the Drupal 6 upload settings to Drupal 8 entity display migration.
* Tests Drupal 6 upload settings to Drupal 8 entity display migration.
*/
public function testUploadEntityDisplay() {
$this->executeMigration('d6_upload_entity_display');
$display = EntityViewDisplay::load('node.page.default');
$component = $display->getComponent('upload');
$this->assertIdentical('file_default', $component['type']);
......@@ -46,4 +47,23 @@ public function testUploadEntityDisplay() {
$this->assertIdentical(['node', 'page', 'default', 'upload'], $this->getMigration('d6_upload_entity_display')->getIdMap()->lookupDestinationID(['page']));
}
/**
* Tests that entity displays are ignored appropriately.
*
* Entity displays should be ignored when they belong to node types which
* were not migrated.
*/
public function testSkipNonExistentNodeType() {
// The "story" node type is migrated by d6_node_type but we need to pretend
// that it didn't occur, so record that in the map table.
$this->mockFailure('d6_node_type', ['type' => 'story']);
// d6_upload_entity_display should skip over the "story" node type config
// because, according to the map table, it didn't occur.
$migration = $this->getMigration('d6_upload_entity_display');
$this->executeMigration($migration);
$this->assertNull($migration->getIdMap()->lookupDestinationIds(['node_type' => 'story'])[0][0]);
}
}
......@@ -23,13 +23,14 @@ class MigrateUploadEntityFormDisplayTest extends MigrateDrupal6TestBase {
protected function setUp() {
parent::setUp();
$this->migrateFields();
$this->executeMigration('d6_upload_entity_form_display');
}
/**
* Tests the Drupal 6 upload settings to Drupal 8 entity form display migration.
* Tests Drupal 6 upload settings to Drupal 8 entity form display migration.
*/
public function testUploadEntityFormDisplay() {
$this->executeMigration('d6_upload_entity_form_display');
$display = EntityFormDisplay::load('node.page.default');
$component = $display->getComponent('upload');
$this->assertIdentical('file_generic', $component['type']);
......@@ -46,4 +47,23 @@ public function testUploadEntityFormDisplay() {
$this->assertIdentical(['node', 'page', 'default', 'upload'], $this->getMigration('d6_upload_entity_form_display')->getIdMap()->lookupDestinationID(['page']));
}
/**
* Tests that entity displays are ignored appropriately.
*
* Entity displays should be ignored when they belong to node types which
* were not migrated.
*/
public function testSkipNonExistentNodeType() {
// The "story" node type is migrated by d6_node_type but we need to pretend
// that it didn't occur, so record that in the map table.
$this->mockFailure('d6_node_type', ['type' => 'story']);
// d6_upload_entity_form_display should skip over the "story" node type
// config because according to the map table, it didn't occur.
$migration = $this->getMigration('d6_upload_entity_form_display');
$this->executeMigration($migration);
$this->assertNull($migration->getIdMap()->lookupDestinationIds(['node_type' => 'story'])[0][0]);
}
}
......@@ -15,7 +15,14 @@ process:
entity_type: 'constants/entity_type'
view_mode: 'constants/view_mode'
options: 'constants/options'
bundle: type
bundle:
-
plugin: migration_lookup
migration: d6_node_type
source: type
-
plugin: skip_on_empty
method: row
field_name:
plugin: migration_lookup
migration: d6_taxonomy_vocabulary
......
......@@ -19,7 +19,14 @@ process:
0: options_select
1: entity_reference_autocomplete_tags
options/weight: 'constants/options/weight'
bundle: type
bundle:
-
plugin: migration_lookup
migration: d6_node_type
source: type
-
plugin: skip_on_empty
method: row
field_name:
plugin: migration_lookup
migration: d6_taxonomy_vocabulary
......
......@@ -10,7 +10,14 @@ source:
selection_handler: 'default:taxonomy_term'
process:
entity_type: 'constants/entity_type'
bundle: type
bundle:
-
plugin: migration_lookup
migration: d6_node_type
source: type
-
plugin: skip_on_empty
method: row
field_name:
-
plugin: migration_lookup
......
......@@ -22,13 +22,24 @@ class MigrateVocabularyEntityDisplayTest extends MigrateDrupal6TestBase {
*/
protected function setUp() {
parent::setUp();
$this->migrateTaxonomy();
// Execute Dependency Migrations.
$this->migrateContentTypes();
$this->installEntitySchema('taxonomy_term');
$this->executeMigrations([
'd6_node_type',
'd6_taxonomy_vocabulary',
'd6_vocabulary_field',
'd6_vocabulary_field_instance',
]);
}
/**
* Tests the Drupal 6 vocabulary-node type association to Drupal 8 migration.
*/
public function testVocabularyEntityDisplay() {
$this->executeMigration('d6_vocabulary_entity_display');
// Test that the field exists.
$component = EntityViewDisplay::load('node.page.default')->getComponent('tags');
$this->assertIdentical('entity_reference_label', $component['type']);
......@@ -37,4 +48,23 @@ public function testVocabularyEntityDisplay() {
$this->assertIdentical(['node', 'article', 'default', 'tags'], $this->getMigration('d6_vocabulary_entity_display')->getIdMap()->lookupDestinationID([4, 'article']));
}
/**
* Tests that vocabulary displays are ignored appropriately.
*
* Vocabulary displays should be ignored when they belong to node types which
* were not migrated.
*/
public function testSkipNonExistentNodeType() {
// The "story" node type is migrated by d6_node_type but we need to pretend
// that it didn't occur, so record that in the map table.
$this->mockFailure('d6_node_type', ['type' => 'story']);
// d6_vocabulary_entity_display should skip over the "story" node type
// config because, according to the map table, it didn't occur.
$migration = $this->getMigration('d6_vocabulary_entity_display');
$this->executeMigration($migration);
$this->assertNull($migration->getIdMap()->lookupDestinationIds(['type' => 'story'])[0][0]);
}
}
......@@ -22,13 +22,24 @@ class MigrateVocabularyEntityFormDisplayTest extends MigrateDrupal6TestBase {
*/
protected function setUp() {
parent::setUp();
$this->migrateTaxonomy();
// Execute Dependency Migrations.
$this->migrateContentTypes();
$this->installEntitySchema('taxonomy_term');
$this->executeMigrations([
'd6_taxonomy_vocabulary',
'd6_vocabulary_field',
'd6_vocabulary_field_instance',
'd6_vocabulary_entity_display',
]);
}
/**
* Tests the Drupal 6 vocabulary-node type association to Drupal 8 migration.
*/
public function testVocabularyEntityFormDisplay() {
$this->executeMigration('d6_vocabulary_entity_form_display');
// Test that the field exists.
$component = EntityFormDisplay::load('node.page.default')->getComponent('tags');
$this->assertIdentical('options_select', $component['type']);
......@@ -42,4 +53,23 @@ public function testVocabularyEntityFormDisplay() {
$this->assertIdentical($entity_form_display->getComponent('vocabulary_2_i_1_')['type'], 'entity_reference_autocomplete_tags');
}
/**
* Tests that vocabulary displays are ignored appropriately.
*
* Vocabulary displays should be ignored when they belong to node types which
* were not migrated.
*/
public function testSkipNonExistentNodeType() {
// The "story" node type is migrated by d6_node_type but we need to pretend
// that it didn't occur, so record that in the map table.
$this->mockFailure('d6_node_type', ['type' => 'story']);
// d6_vocabulary_entity_form_display should skip over the "story" node type
// config because, according to the map table, it didn't occur.
$migration = $this->getMigration('d6_vocabulary_entity_form_display');
$this->executeMigration($migration);
$this->assertNull($migration->getIdMap()->lookupDestinationIds(['type' => 'story'])[0][0]);
}
}
......@@ -22,13 +22,23 @@ class MigrateVocabularyFieldInstanceTest extends MigrateDrupal6TestBase {
*/
protected function setUp() {
parent::setUp();
$this->migrateTaxonomy();
// Execute Dependency Migrations.
$this->migrateContentTypes();
$this->installEntitySchema('taxonomy_term');
$this->executeMigrations([
'd6_node_type',
'd6_taxonomy_vocabulary',
'd6_vocabulary_field',
]);
}
/**
* Tests the Drupal 6 vocabulary-node type association to Drupal 8 migration.
*/
public function testVocabularyFieldInstance() {
$this->executeMigration('d6_vocabulary_field_instance');
// Test that the field exists.
$field_id = 'node.article.tags';
$field = FieldConfig::load($field_id);
......@@ -50,10 +60,29 @@ public function testVocabularyFieldInstance() {
$this->assertIdentical(['node', 'article', 'tags'], $this->getMigration('d6_vocabulary_field_instance')->getIdMap()->lookupDestinationID([4, 'article']));
// Test the the field vocabulary_1_i_0_
// Test the the field vocabulary_1_i_0_.
$field_id = 'node.story.vocabulary_1_i_0_';
$field = FieldConfig::load($field_id);
$this->assertFalse($field->isRequired(), 'Field is not required');
}
/**
* Tests that vocabulary field instances are ignored appropriately.
*
* Vocabulary field instances should be ignored when they belong to node
* types which were not migrated.
*/
public function testSkipNonExistentNodeType() {
// The "story" node type is migrated by d6_node_type but we need to pretend
// that it didn't occur, so record that in the map table.
$this->mockFailure('d6_node_type', ['type' => 'story']);
// d6_vocabulary_field_instance should skip over the "story" node type
// config because, according to the map table, it didn't occur.
$migration = $this->getMigration('d6_vocabulary_field_instance');
$this->executeMigration($migration);
$this->assertNull($migration->getIdMap()->lookupDestinationIds(['type' => 'story'])[0][0]);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment