Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / taxonomy / tests / src / Kernel / Migrate / d6 / MigrateTaxonomyVocabularyTest.php
1 <?php
2
3 namespace Drupal\Tests\taxonomy\Kernel\Migrate\d6;
4
5 use Drupal\taxonomy\Entity\Vocabulary;
6 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
7
8 /**
9  * Migrate taxonomy vocabularies to taxonomy.vocabulary.*.yml.
10  *
11  * @group migrate_drupal_6
12  */
13 class MigrateTaxonomyVocabularyTest extends MigrateDrupal6TestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public static $modules = ['taxonomy'];
19
20   /**
21    * {@inheritdoc}
22    */
23   protected function setUp() {
24     parent::setUp();
25     $this->executeMigration('d6_taxonomy_vocabulary');
26   }
27
28   /**
29    * Tests the Drupal 6 taxonomy vocabularies to Drupal 8 migration.
30    */
31   public function testTaxonomyVocabulary() {
32     for ($i = 0; $i < 3; $i++) {
33       $j = $i + 1;
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'));
40     }
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'));
46   }
47
48 }