MigrateTaxonomyVocabularyTest.php in Zircon Profile 8
File
core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTaxonomyVocabularyTest.php
View source
<?php
namespace Drupal\taxonomy\Tests\Migrate\d6;
use Drupal\migrate\Entity\Migration;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
class MigrateTaxonomyVocabularyTest extends MigrateDrupal6TestBase {
public static $modules = array(
'taxonomy',
);
protected function setUp() {
parent::setUp();
$this
->executeMigration('d6_taxonomy_vocabulary');
}
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'));
}
}