Commit 6aea117e authored by webchick's avatar webchick

Issue #2588707 by phenaproxima, neclimdul: CCK field migrations throw...

Issue #2588707 by phenaproxima, neclimdul: CCK field migrations throw exceptions is the destination bundle doesn't exist
parent abbeb3c9
......@@ -28,7 +28,14 @@ process:
index:
- 1
entity_type: 'constants/entity_type'
bundle: type_name
bundle:
-
plugin: migration
migration: d6_node_type
source: type_name
-
plugin: skip_on_empty
method: row
view_mode:
-
plugin: migration
......
......@@ -28,7 +28,14 @@ process:
method: row
entity_type: 'constants/entity_type'
field_name: field_name
bundle: type_name
bundle:
-
plugin: migration
migration: d6_node_type
source: type_name
-
plugin: skip_on_empty
method: row
label: label
description: description
required: required
......
......@@ -28,7 +28,14 @@ process:
-
plugin: skip_on_empty
method: row
bundle: type_name
bundle:
-
plugin: migration
migration: d6_node_type
source: type_name
-
plugin: skip_on_empty
method: row
form_mode: 'constants/form_mode'
field_name: field_name
entity_type: 'constants/entity_type'
......
......@@ -20,17 +20,11 @@
class MigrateFieldInstanceTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
* Tests migration of file variables to file.settings.yml.
*/
protected function setUp() {
parent::setUp();
public function testFieldInstanceMigration() {
$this->migrateFields();
}
/**
* Tests migration of file variables to file.settings.yml.
*/
public function testFieldInstanceSettings() {
$entity = Node::create(['type' => 'story']);
// Test a text field.
$field = FieldConfig::load('node.story.field_test');
......@@ -98,4 +92,20 @@ public function testFieldInstanceSettings() {
$this->assertIdentical([], $entity->field_test_link->options['attributes']);
}
/**
* Tests migrating fields into non-existent content types.
*/
public function testMigrateFieldIntoUnknownNodeType() {
$this->sourceDatabase->delete('node_type')
->condition('type', 'test_planet')
->execute();
// The field migrations use the migration plugin to ensure that the node
// types exist, so this should produce no failures...
$this->migrateFields();
// ...and the field instances should not have been migrated.
$this->assertNull(FieldConfig::load('node.test_planet.field_multivalue'));
$this->assertNull(FieldConfig::load('node.test_planet.field_test_text_single_checkbox'));
}
}
......@@ -11,7 +11,14 @@ source:
description_field: 1
process:
entity_type: 'constants/entity_type'
bundle: node_type
bundle:
-
plugin: migration
migration: d6_node_type
source: node_type
-
plugin: skip_on_empty
method: row
field_name: 'constants/name'
settings: 'constants/settings'
'settings/file_extensions': file_extensions
......
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