Issue #3097327 by Wim Leers, quietone, Meenakshi.g: d7_node_title_label migration plugin incorrectly generating base_field_override for every node type, even those that don't have an overridden title label

merge-requests/2419/head
webchick 2019-12-20 17:49:09 -08:00
parent 60b75a6d52
commit c2ea8a58aa
3 changed files with 24 additions and 7 deletions

View File

@ -101,7 +101,7 @@ class Upgrade7Test extends MigrateUpgradeExecuteTestBase {
'entity_form_mode' => 1,
'entity_view_display' => 31,
'entity_view_mode' => 14,
'base_field_override' => 9,
'base_field_override' => 4,
];
}

View File

@ -9,10 +9,19 @@ source:
entity_type: node
field_name: title
process:
label:
-
plugin: static_map
source: title_label
bypass: true
map:
Title: 0
-
plugin: skip_on_empty
method: row
entity_type: 'constants/entity_type'
bundle: type
field_name: 'constants/field_name'
label: title_label
destination:
plugin: entity:base_field_override
migration_dependencies:

View File

@ -42,12 +42,20 @@ class MigrateNodeTitleLabelTest extends MigrateDrupal7TestBase {
* Tests migration of node title field overrides.
*/
public function testMigration() {
$this->assertEntity('node.article.title', 'Title');
$this->assertEntity('node.blog.title', 'Title');
$this->assertEntity('node.book.title', 'Title');
// Forum title labels are overridden to 'Subject'.
$this->assertEntity('node.forum.title', 'Subject');
$this->assertEntity('node.page.title', 'Title');
$this->assertEntity('node.test_content_type.title', 'Title');
// Other content types use the default of 'Title' and are not overridden.
$no_override_node_type = [
'article',
'blog',
'book',
'page',
'test_content_type',
];
foreach ($no_override_node_type as $type) {
$override = BaseFieldOverride::load("node.$type.title");
$this->assertFalse($override instanceof BaseFieldOverride);
}
}
}