Version 1
[yaffs-website] / web / core / modules / taxonomy / tests / src / Kernel / Migrate / d6 / MigrateVocabularyFieldTest.php
diff --git a/web/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldTest.php b/web/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldTest.php
new file mode 100644 (file)
index 0000000..784da4a
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+
+namespace Drupal\Tests\taxonomy\Kernel\Migrate\d6;
+
+use Drupal\field\Entity\FieldStorageConfig;
+use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
+
+/**
+ * Vocabulary field migration.
+ *
+ * @group migrate_drupal_6
+ */
+class MigrateVocabularyFieldTest extends MigrateDrupal6TestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['taxonomy', 'menu_ui'];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+    $this->migrateTaxonomy();
+  }
+
+  /**
+   * Tests the Drupal 6 vocabulary-node type association to Drupal 8 migration.
+   */
+  public function testVocabularyField() {
+    // Test that the field exists.
+    $field_storage_id = 'node.tags';
+    /** @var \Drupal\field\FieldStorageConfigInterface $field_storage */
+    $field_storage = FieldStorageConfig::load($field_storage_id);
+    $this->assertIdentical($field_storage_id, $field_storage->id());
+
+    $settings = $field_storage->getSettings();
+    $this->assertIdentical('taxonomy_term', $settings['target_type'], "Target type is correct.");
+    $this->assertIdentical(1, $field_storage->getCardinality(), "Field cardinality in 1.");
+
+    $this->assertIdentical(['node', 'tags'], $this->getMigration('d6_vocabulary_field')->getIdMap()->lookupDestinationID([4]), "Test IdMap");
+  }
+
+}