3 namespace Drupal\Tests\taxonomy\Kernel\Migrate\d6;
5 use Drupal\taxonomy\Entity\Vocabulary;
6 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
9 * Migrate taxonomy vocabularies to taxonomy.vocabulary.*.yml.
11 * @group migrate_drupal_6
13 class MigrateTaxonomyVocabularyTest extends MigrateDrupal6TestBase {
18 public static $modules = ['taxonomy'];
23 protected function setUp() {
25 $this->executeMigration('d6_taxonomy_vocabulary');
29 * Tests the Drupal 6 taxonomy vocabularies to Drupal 8 migration.
31 public function testTaxonomyVocabulary() {
32 for ($i = 0; $i < 3; $i++) {
34 $vocabulary = Vocabulary::load("vocabulary_{$j}_i_{$i}_");
35 $this->assertSame($this->getMigration('d6_taxonomy_vocabulary')->getIdMap()->lookupDestinationID([$j]), [$vocabulary->id()]);
36 $this->assertSame("vocabulary $j (i=$i)", $vocabulary->label());
37 $this->assertSame("description of vocabulary $j (i=$i)", $vocabulary->getDescription());
38 $this->assertSame($i, $vocabulary->getHierarchy());
39 $this->assertSame(4 + $i, $vocabulary->get('weight'));
41 $vocabulary = Vocabulary::load('vocabulary_name_much_longer_than');
42 $this->assertSame('vocabulary name much longer than thirty two characters', $vocabulary->label());
43 $this->assertSame('description of vocabulary name much longer than thirty two characters', $vocabulary->getDescription());
44 $this->assertSame(3, $vocabulary->getHierarchy());
45 $this->assertSame(7, $vocabulary->get('weight'));