You are here

public function MigrateTaxonomyVocabularyTest::testTaxonomyVocabulary in Zircon Profile 8

Same name in this branch
  1. 8 core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTaxonomyVocabularyTest.php \Drupal\taxonomy\Tests\Migrate\d6\MigrateTaxonomyVocabularyTest::testTaxonomyVocabulary()
  2. 8 core/modules/taxonomy/src/Tests/Migrate/d7/MigrateTaxonomyVocabularyTest.php \Drupal\taxonomy\Tests\Migrate\d7\MigrateTaxonomyVocabularyTest::testTaxonomyVocabulary()
Same name and namespace in other branches
  1. 8.0 core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTaxonomyVocabularyTest.php \Drupal\taxonomy\Tests\Migrate\d6\MigrateTaxonomyVocabularyTest::testTaxonomyVocabulary()

Tests the Drupal 6 taxonomy vocabularies to Drupal 8 migration.

File

core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTaxonomyVocabularyTest.php, line 37
Contains \Drupal\taxonomy\Tests\Migrate\d6\MigrateTaxonomyVocabularyTest.

Class

MigrateTaxonomyVocabularyTest
Migrate taxonomy vocabularies to taxonomy.vocabulary.*.yml.

Namespace

Drupal\taxonomy\Tests\Migrate\d6

Code

public function testTaxonomyVocabulary() {
  for ($i = 0; $i < 3; $i++) {
    $j = $i + 1;
    $vocabulary = Vocabulary::load("vocabulary_{$j}_i_{$i}_");
    $this
      ->assertIdentical(Migration::load('d6_taxonomy_vocabulary')
      ->getIdMap()
      ->lookupDestinationID(array(
      $j,
    )), array(
      $vocabulary
        ->id(),
    ));
    $this
      ->assertIdentical("vocabulary {$j} (i={$i})", $vocabulary
      ->label());
    $this
      ->assertIdentical("description of vocabulary {$j} (i={$i})", $vocabulary
      ->getDescription());
    $this
      ->assertIdentical($i, $vocabulary
      ->getHierarchy());
    $this
      ->assertIdentical(4 + $i, $vocabulary
      ->get('weight'));
  }
  $vocabulary = Vocabulary::load('vocabulary_name_much_longer_than');
  $this
    ->assertIdentical('vocabulary name much longer than thirty two characters', $vocabulary
    ->label());
  $this
    ->assertIdentical('description of vocabulary name much longer than thirty two characters', $vocabulary
    ->getDescription());
  $this
    ->assertIdentical(3, $vocabulary
    ->getHierarchy());
  $this
    ->assertIdentical(7, $vocabulary
    ->get('weight'));
}