MigrateTaxonomyVocabularyTest.php in Zircon Profile 8
File
core/modules/taxonomy/src/Tests/Migrate/d7/MigrateTaxonomyVocabularyTest.php
View source
<?php
namespace Drupal\taxonomy\Tests\Migrate\d7;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
use Drupal\taxonomy\VocabularyInterface;
class MigrateTaxonomyVocabularyTest extends MigrateDrupal7TestBase {
public static $modules = array(
'taxonomy',
);
protected function setUp() {
parent::setUp();
$this
->executeMigration('d7_taxonomy_vocabulary');
}
protected function assertEntity($id, $expected_label, $expected_description, $expected_hierarchy, $expected_weight) {
$entity = Vocabulary::load($id);
$this
->assertTrue($entity instanceof VocabularyInterface);
$this
->assertIdentical($expected_label, $entity
->label());
$this
->assertIdentical($expected_description, $entity
->getDescription());
$this
->assertIdentical($expected_hierarchy, $entity
->getHierarchy());
$this
->assertIdentical($expected_weight, $entity
->get('weight'));
}
public function testTaxonomyVocabulary() {
$this
->assertEntity('tags', 'Tags', 'Use tags to group articles on similar topics into categories.', TAXONOMY_HIERARCHY_DISABLED, 0);
$this
->assertEntity('forums', 'Forums', 'Forum navigation vocabulary', TAXONOMY_HIERARCHY_SINGLE, -10);
$this
->assertEntity('test_vocabulary', 'Test Vocabulary', 'This is the vocabulary description', TAXONOMY_HIERARCHY_SINGLE, 0);
}
}