Commit 0baa35af authored by catch's avatar catch
Browse files

Issue #2998875 by quietone, juampynr, benjifisher, smustgrave, alison: Map...

Issue #2998875 by quietone, juampynr, benjifisher, smustgrave, alison: Map menu ids like main-menu when migrating node types

(cherry picked from commit a33a7f8a)
parent 65f0369b
Loading
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -21,7 +21,23 @@ process:
  'settings/node/options': options
  create_body: has_body
  create_body_label: body_label
  'third_party_settings/menu_ui/available_menus': available_menus
  'third_party_settings/menu_ui/parent': parent
  'third_party_settings/menu_ui/available_menus':
    plugin: static_map
    bypass: true
    source: available_menus
    map:
      main-menu: main
      management: admin
      navigation: tools
      user-menu: account
  'third_party_settings/menu_ui/parent':
    plugin: static_map
    bypass: true
    source: parent
    map:
      'main-menu:': 'main:'
      'management:': 'admin:'
      'navigation:': 'tools:'
      'user-menu:': 'account:'
destination:
  plugin: entity:node_type
+18 −2
Original line number Diff line number Diff line
@@ -18,7 +18,23 @@ process:
  new_revision: 'options/revision'
  create_body: create_body
  create_body_label: body_label
  'third_party_settings/menu_ui/available_menus': available_menus
  'third_party_settings/menu_ui/parent': parent
  'third_party_settings/menu_ui/available_menus':
    plugin: static_map
    bypass: true
    source: available_menus
    map:
      main-menu: main
      management: admin
      navigation: tools
      user-menu: account
  'third_party_settings/menu_ui/parent':
    plugin: static_map
    bypass: true
    source: parent
    map:
      'main-menu:0:': 'main:'
      'management:0:': 'admin:'
      'navigation:0:': 'tools:'
      'user-menu:0:': 'account:'
destination:
  plugin: entity:node_type
+6 −6
Original line number Diff line number Diff line
@@ -45,9 +45,9 @@ public function testNodeType() {
    $this->assertSame('This is the body field label', $field->getLabel(), 'Body field was found.');

    // Test default menus.
    $expected_available_menus = ['navigation'];
    $expected_available_menus = ['tools'];
    $this->assertSame($expected_available_menus, $node_type_page->getThirdPartySetting('menu_ui', 'available_menus'));
    $expected_parent = 'navigation:';
    $expected_parent = 'tools:';
    $this->assertSame($expected_parent, $node_type_page->getThirdPartySetting('menu_ui', 'parent'));

    // Test the test_story content type.
@@ -64,9 +64,9 @@ public function testNodeType() {
    $this->assertNull($field, 'No body field found');

    // Test default menus.
    $expected_available_menus = ['navigation'];
    $expected_available_menus = ['tools'];
    $this->assertSame($expected_available_menus, $node_type_story->getThirdPartySetting('menu_ui', 'available_menus'));
    $expected_parent = 'navigation:';
    $expected_parent = 'tools:';
    $this->assertSame($expected_parent, $node_type_story->getThirdPartySetting('menu_ui', 'parent'));

    // Test the test_event content type.
@@ -82,9 +82,9 @@ public function testNodeType() {
    $field = FieldConfig::loadByName('node', 'test_event', 'body');
    $this->assertSame('Body', $field->getLabel(), 'Body field was found.');

    $expected_available_menus = ['navigation'];
    $expected_available_menus = ['tools'];
    $this->assertSame($expected_available_menus, $node_type_event->getThirdPartySetting('menu_ui', 'available_menus'));
    $expected_parent = 'navigation:';
    $expected_parent = 'tools:';
    $this->assertSame($expected_parent, $node_type_event->getThirdPartySetting('menu_ui', 'parent'));

    // Test the 32 character type name exists.
+6 −6
Original line number Diff line number Diff line
@@ -81,8 +81,8 @@ protected function assertEntity(string $id, string $label, string $description,
   * Tests Drupal 7 node type to Drupal 8 migration.
   */
  public function testNodeType() {
    $expected_available_menus = ['main-menu'];
    $expected_parent = 'main-menu:0:';
    $expected_available_menus = ['main'];
    $expected_parent = 'main:';

    $this->assertEntity('article', 'Article', 'Use <em>articles</em> for time-sensitive content like news, press releases or blog posts.', 'Help text for articles', TRUE, FALSE, $expected_available_menus, $expected_parent, "Body");
    $this->assertEntity('blog', 'Blog entry', 'Use for multi-user blogs. Every user gets a personal blog.', 'Blog away, good sir!', TRUE, FALSE, $expected_available_menus, $expected_parent, 'Body');
@@ -95,10 +95,10 @@ public function testNodeType() {

    // This node type does not carry a body field.
    $expected_available_menus = [
      'main-menu',
      'management',
      'navigation',
      'user-menu',
      'main',
      'admin',
      'tools',
      'account',
    ];
    $this->assertEntity('test_content_type', 'Test content type', 'This is the description of the test content type.', 'Help text for test content type', FALSE, TRUE, $expected_available_menus, $expected_parent);
  }