function MigrateVocabularyEntityFormDisplayTest::testVocabularyEntityFormDisplay

Same name in this branch
  1. 11.x core/modules/forum/tests/src/Kernel/Migrate/d6/MigrateVocabularyEntityFormDisplayTest.php \Drupal\Tests\forum\Kernel\Migrate\d6\MigrateVocabularyEntityFormDisplayTest::testVocabularyEntityFormDisplay()
Same name in other branches
  1. 9 core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyEntityFormDisplayTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d6\MigrateVocabularyEntityFormDisplayTest::testVocabularyEntityFormDisplay()
  2. 8.9.x core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyEntityFormDisplayTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d6\MigrateVocabularyEntityFormDisplayTest::testVocabularyEntityFormDisplay()
  3. 10 core/modules/forum/tests/src/Kernel/Migrate/d6/MigrateVocabularyEntityFormDisplayTest.php \Drupal\Tests\forum\Kernel\Migrate\d6\MigrateVocabularyEntityFormDisplayTest::testVocabularyEntityFormDisplay()
  4. 10 core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyEntityFormDisplayTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d6\MigrateVocabularyEntityFormDisplayTest::testVocabularyEntityFormDisplay()

Tests the Drupal 6 vocabulary-node type association to Drupal 8 migration.

File

core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyEntityFormDisplayTest.php, line 42

Class

MigrateVocabularyEntityFormDisplayTest
Vocabulary entity form display migration.

Namespace

Drupal\Tests\taxonomy\Kernel\Migrate\d6

Code

public function testVocabularyEntityFormDisplay() : void {
    $this->executeMigration('d6_vocabulary_entity_form_display');
    // Test that the field exists.
    $component = EntityFormDisplay::load('node.page.default')->getComponent('field_tags');
    $this->assertSame('options_select', $component['type']);
    $this->assertSame(20, $component['weight']);
    // Test the Id map.
    $this->assertSame([
        [
            'node',
            'article',
            'default',
            'field_tags',
        ],
    ], $this->getMigration('d6_vocabulary_entity_form_display')
        ->getIdMap()
        ->lookupDestinationIds([
        4,
        'article',
    ]));
    // Test the term widget tags setting.
    $entity_form_display = EntityFormDisplay::load('node.story.default');
    $this->assertSame($entity_form_display->getComponent('field_vocabulary_1_i_0_')['type'], 'options_select');
    $this->assertSame($entity_form_display->getComponent('field_vocabulary_2_i_1_')['type'], 'entity_reference_autocomplete_tags');
    // Tests that a vocabulary named like a D8 base field will be migrated and
    // prefixed with 'field_' to avoid conflicts.
    $field_type = EntityFormDisplay::load('node.sponsor.default')->getComponent('field_type');
    $this->assertIsArray($field_type);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.