diff --git a/core/modules/taxonomy/migration_templates/d6_taxonomy_settings.yml b/core/modules/taxonomy/migration_templates/d7_taxonomy_settings.yml index 3fe9e1f..ed8a779 100644 --- a/core/modules/taxonomy/migration_templates/d6_taxonomy_settings.yml +++ b/core/modules/taxonomy/migration_templates/d7_taxonomy_settings.yml @@ -1,7 +1,7 @@ -id: d6_taxonomy_settings -label: Drupal 6 taxonomy configuration +id: d7_taxonomy_settings +label: Drupal 7 taxonomy configuration migration_tags: - - Drupal 6 + - Drupal 7 source: plugin: variable variables: diff --git a/core/modules/taxonomy/migration_templates/d6_taxonomy_term.yml b/core/modules/taxonomy/migration_templates/d7_taxonomy_term.yml old mode 100644 new mode 100755 index 546f95f..46803a7 --- a/core/modules/taxonomy/migration_templates/d6_taxonomy_term.yml +++ b/core/modules/taxonomy/migration_templates/d7_taxonomy_term.yml @@ -1,14 +1,14 @@ -id: d6_taxonomy_term -label: Drupal 6 taxonomy terms +id: d7_taxonomy_term +label: Drupal 7 taxonomy terms migration_tags: - - Drupal 6 + - Drupal 7 source: - plugin: d6_taxonomy_term + plugin: d7_taxonomy_term process: tid: tid vid: plugin: migration - migration: d6_taxonomy_vocabulary + migration: d7_taxonomy_vocabulary source: vid name: name description: description @@ -16,14 +16,14 @@ process: parent: - plugin: skip_on_empty - method: process source: parent + method: process - plugin: migration - migration: d6_taxonomy_term + migration: d7_taxonomy_term changed: timestamp destination: plugin: entity:taxonomy_term migration_dependencies: required: - - d6_taxonomy_vocabulary + - d7_taxonomy_vocabulary diff --git a/core/modules/taxonomy/migration_templates/d6_taxonomy_vocabulary.yml b/core/modules/taxonomy/migration_templates/d7_taxonomy_vocabulary.yml old mode 100644 new mode 100755 index 414d2cb..065c19a --- a/core/modules/taxonomy/migration_templates/d6_taxonomy_vocabulary.yml +++ b/core/modules/taxonomy/migration_templates/d7_taxonomy_vocabulary.yml @@ -1,14 +1,14 @@ -id: d6_taxonomy_vocabulary -label: Drupal 6 taxonomy vocabularies +id: d7_taxonomy_vocabulary +label: Drupal 7 taxonomy vocabularies migration_tags: - - Drupal 6 + - Drupal 7 source: - plugin: d6_taxonomy_vocabulary + plugin: d7_taxonomy_vocabulary process: vid: - plugin: machine_name - source: name + source: machine_name - plugin: dedupe_entity entity_type: taxonomy_vocabulary diff --git a/core/modules/taxonomy/src/Plugin/migrate/source/d6/Term.php b/core/modules/taxonomy/src/Plugin/migrate/source/d7/Term.php old mode 100644 new mode 100755 index 841faca..6d86f25 --- a/core/modules/taxonomy/src/Plugin/migrate/source/d6/Term.php +++ b/core/modules/taxonomy/src/Plugin/migrate/source/d7/Term.php @@ -2,21 +2,21 @@ /** * @file - * Contains \Drupal\taxonomy\Plugin\migrate\source\d6\Term. + * Contains \Drupal\taxonomy\Plugin\migrate\source\Term. */ -namespace Drupal\taxonomy\Plugin\migrate\source\d6; +namespace Drupal\taxonomy\Plugin\migrate\source\d7; use Drupal\migrate\Row; use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase; /** - * Drupal 6 taxonomy terms source from database. + * Drupal 7 taxonomy terms source from database. * * @todo Support term_relation, term_synonym table if possible. * * @MigrateSource( - * id = "d6_taxonomy_term", + * id = "d7_taxonomy_term", * source_provider = "taxonomy" * ) */ @@ -28,12 +28,9 @@ class Term extends DrupalSqlBase { public function query() { // Note the explode - this supports the (admittedly unusual) case of // consolidating multiple vocabularies into one. - $query = $this->select('term_data', 'td') - ->fields('td', array('tid', 'vid', 'name', 'description', 'weight')) - // This works, but we cannot test that, because there is no support for - // distinct() in FakeSelect, yet. - ->distinct() - ->orderBy('tid'); + $query = $this->select('taxonomy_term_data', 'td') + ->fields('td') + ->distinct(); if (isset($this->configuration['vocabulary'])) { $query->condition('vid', $this->configuration['vocabulary'], 'IN'); } @@ -59,7 +56,7 @@ public function fields() { */ public function prepareRow(Row $row) { // Find parents for this row. - $parents = $this->select('term_hierarchy', 'th') + $parents = $this->select('taxonomy_term_hierarchy', 'th') ->fields('th', array('parent', 'tid')) ->condition('tid', $row->getSourceProperty('tid')) ->execute() diff --git a/core/modules/taxonomy/src/Plugin/migrate/source/d6/Vocabulary.php b/core/modules/taxonomy/src/Plugin/migrate/source/d7/Vocabulary.php old mode 100644 new mode 100755 index 2ed3c00..dc22070 --- a/core/modules/taxonomy/src/Plugin/migrate/source/d6/Vocabulary.php +++ b/core/modules/taxonomy/src/Plugin/migrate/source/d7/Vocabulary.php @@ -2,35 +2,56 @@ /** * @file - * Contains \Drupal\taxonomy\Plugin\migrate\source\d6\Vocabulary. + * Contains \Drupal\taxonomy\Plugin\migrate\source\Vocabulary. */ -namespace Drupal\taxonomy\Plugin\migrate\source\d6; +namespace Drupal\taxonomy\Plugin\migrate\source\d7; -use Drupal\migrate\Row; +use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase; /** - * Drupal 6 vocabularies source from database. + * Drupal 7 vocabularies source from database. * * @MigrateSource( - * id = "d6_taxonomy_vocabulary", + * id = "d7_taxonomy_vocabulary", * source_provider = "taxonomy" * ) */ -class Vocabulary extends VocabularyBase { +class Vocabulary extends DrupalSqlBase { /** * {@inheritdoc} */ - public function prepareRow(Row $row) { - // Find node types for this row. - $node_types = $this->select('vocabulary_node_types', 'nt') - ->fields('nt', array('type', 'vid')) - ->condition('vid', $row->getSourceProperty('vid')) - ->execute() - ->fetchCol(); - $row->setSourceProperty('node_types', $node_types); - return parent::prepareRow($row); + public function query() { + $query = $this->select('taxonomy_vocabulary', 'v') + ->fields('v', array( + 'vid', + 'name', + 'description', + 'hierarchy', + 'module', + 'weight', + 'machine_name' + )); + $query->condition('vid', array(5, 6), 'NOT IN'); + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'vid' => $this->t('The vocabulary ID.'), + 'name' => $this->t('The name of the vocabulary.'), + 'description' => $this->t('The description of the vocabulary.'), + 'help' => $this->t('Help text to display for the vocabulary.'), + 'relations' => $this->t('Whether or not related terms are enabled within the vocabulary. (0 = disabled, 1 = enabled)'), + 'hierarchy' => $this->t('The type of hierarchy allowed within the vocabulary. (0 = disabled, 1 = single, 2 = multiple)'), + 'weight' => $this->t('The weight of the vocabulary in relation to other vocabularies.'), + 'parents' => $this->t("The Drupal term IDs of the term's parents."), + 'node_types' => $this->t('The names of the node types the vocabulary may be used with.'), + ); } /** diff --git a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTaxonomyConfigsTest.php b/core/modules/taxonomy/src/Tests/Migrate/d7/MigrateTaxonomySettingsTest.php index 08b12a9..c8f077a 100644 --- a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTaxonomyConfigsTest.php +++ b/core/modules/taxonomy/src/Tests/Migrate/d7/MigrateTaxonomySettingsTest.php @@ -2,20 +2,20 @@ /** * @file - * Contains \Drupal\taxonomy\Tests\Migrate\d6\MigrateTaxonomyConfigsTest. + * Contains \Drupal\taxonomy\Tests\Migrate\d7\MigrateTaxonomySettingsTest. */ -namespace Drupal\taxonomy\Tests\Migrate\d6; +namespace Drupal\taxonomy\Tests\Migrate\d7; use Drupal\config\Tests\SchemaCheckTestTrait; -use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase; +use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase; /** - * Upgrade variables to taxonomy.settings.yml. + * Upgrade variables to taxonomy.settings config object. * * @group taxonomy */ -class MigrateTaxonomyConfigsTest extends MigrateDrupal6TestBase { +class MigrateTaxonomySettingsTest extends MigrateDrupal7TestBase { use SchemaCheckTestTrait; @@ -32,17 +32,16 @@ class MigrateTaxonomyConfigsTest extends MigrateDrupal6TestBase { protected function setUp() { parent::setUp(); $this->loadDumps(['Variable.php']); - $this->executeMigration('d6_taxonomy_settings'); + $this->executeMigration('d7_taxonomy_settings'); } /** * Tests migration of taxonomy variables to taxonomy.settings.yml. */ - public function testTaxonomySettings() { + public function testAggregatorSettings() { $config = $this->config('taxonomy.settings'); - $this->assertIdentical(100, $config->get('terms_per_page_admin')); - $this->assertIdentical(FALSE, $config->get('override_selector')); - $this->assertConfigSchema(\Drupal::service('config.typed'), 'taxonomy.settings', $config->get()); + $this->assertTrue($config->get('override_selector')); + $this->assertIdentical(84, $config->get('terms_per_page_admin')); } } diff --git a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTaxonomyTermTest.php b/core/modules/taxonomy/src/Tests/Migrate/d7/MigrateTaxonomyTermTest.php index 8cf7560..c5b4b1b 100644 --- a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTaxonomyTermTest.php +++ b/core/modules/taxonomy/src/Tests/Migrate/d7/MigrateTaxonomyTermTest.php @@ -2,20 +2,21 @@ /** * @file - * Contains \Drupal\taxonomy\Tests\Migrate\d6\MigrateTaxonomyTermTest. + * Contains \Drupal\taxonomy\Tests\Migrate\d7\MigrateTaxonomyTermTest. */ -namespace Drupal\taxonomy\Tests\Migrate\d6; +namespace Drupal\taxonomy\Tests\Migrate\d7; +use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase; use Drupal\taxonomy\Entity\Term; -use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase; +use Drupal\taxonomy\TermInterface; /** * Upgrade taxonomy terms. * * @group taxonomy */ -class MigrateTaxonomyTermTest extends MigrateDrupal6TestBase { +class MigrateTaxonomyTermTest extends MigrateDrupal7TestBase { static $modules = array('taxonomy', 'text'); @@ -28,81 +29,46 @@ protected function setUp() { $this->installEntitySchema('taxonomy_term'); $this->prepareMigrations(array( - 'd6_taxonomy_vocabulary' => array( - array(array(1), array('vocabulary_1_i_0_')), - array(array(2), array('vocabulary_2_i_1_')), - array(array(3), array('vocabulary_3_i_2_')), + 'd7_taxonomy_vocabulary' => array( + array(array(1), array('tags')), + array(array(2), array('forums')), + array(array(3), array('test_vocabulary')), ))); $this->loadDumps([ - 'TermData.php', - 'TermHierarchy.php', - 'Vocabulary.php', - 'VocabularyNodeTypes.php', + 'TaxonomyTermData.php', + 'TaxonomyTermHierarchy.php', + 'TaxonomyVocabulary.php', ]); - $this->executeMigration('d6_taxonomy_term'); + $this->executeMigration('d7_taxonomy_term'); + } + + protected function assertEntity($id, $expected_label, $expected_vid, $expected_description = '', $expected_weight = 0, $expected_parents = []) { + /** @var \Drupal\taxonomy\TermInterface $entity */ + $entity = Term::load($id); + $this->assertTrue($entity instanceof TermInterface); + $this->assertIdentical($expected_label, $entity->label()); + $this->assertIdentical($expected_vid, $entity->getVocabularyId()); + $this->assertEqual($expected_description, $entity->getDescription()); + $this->assertEqual($expected_weight, $entity->getWeight()); + $this->assertIdentical($expected_parents, $this->getParentIDs($id)); } /** - * Tests the Drupal 6 taxonomy term to Drupal 8 migration. + * Tests the Drupal 7 taxonomy term to Drupal 8 migration. */ public function testTaxonomyTerms() { - $expected_results = array( - '1' => array( - 'source_vid' => 1, - 'vid' => 'vocabulary_1_i_0_', - 'weight' => 0, - 'parent' => array(0), - ), - '2' => array( - 'source_vid' => 2, - 'vid' => 'vocabulary_2_i_1_', - 'weight' => 3, - 'parent' => array(0), - ), - '3' => array( - 'source_vid' => 2, - 'vid' => 'vocabulary_2_i_1_', - 'weight' => 4, - 'parent' => array(2), - ), - '4' => array( - 'source_vid' => 3, - 'vid' => 'vocabulary_3_i_2_', - 'weight' => 6, - 'parent' => array(0), - ), - '5' => array( - 'source_vid' => 3, - 'vid' => 'vocabulary_3_i_2_', - 'weight' => 7, - 'parent' => array(4), - ), - '6' => array( - 'source_vid' => 3, - 'vid' => 'vocabulary_3_i_2_', - 'weight' => 8, - 'parent' => array(4, 5), - ), - ); - $terms = Term::loadMultiple(array_keys($expected_results)); - foreach ($expected_results as $tid => $values) { - /** @var Term $term */ - $term = $terms[$tid]; - $this->assertIdentical("term {$tid} of vocabulary {$values['source_vid']}", $term->name->value); - $this->assertIdentical("description of term {$tid} of vocabulary {$values['source_vid']}", $term->description->value); - $this->assertIdentical($values['vid'], $term->vid->target_id); - $this->assertIdentical((string) $values['weight'], $term->weight->value); - if ($values['parent'] === array(0)) { - $this->assertNull($term->parent->target_id); - } - else { - $parents = array(); - foreach (\Drupal::entityManager()->getStorage('taxonomy_term')->loadParents($tid) as $parent) { - $parents[] = (int) $parent->id(); - } - $this->assertIdentical($parents, $values['parent']); - } - } + $this->assertEntity(1, 'General discussion', 'forums', '', 2); + $this->assertEntity(2, 'Term1', 'test_vocabulary', 'The first term.'); + $this->assertEntity(3, 'Term2', 'test_vocabulary', 'The second term.'); + $this->assertEntity(4, 'Term3', 'test_vocabulary', 'The third term.', 0, [3]); + $this->assertEntity(5, 'Custom Forum', 'forums', 'Where the cool kids are.', 3); + $this->assertEntity(6, 'Games', 'forums', '', 4); + $this->assertEntity(7, 'Minecraft', 'forums', '', 1, [6]); + $this->assertEntity(8, 'Half Life 3', 'forums', '', 0, [6]); + } + + private function getParentIDs($tid) { + return array_keys(\Drupal::entityManager()->getStorage('taxonomy_term')->loadParents($tid)); } } diff --git a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTaxonomyVocabularyTest.php b/core/modules/taxonomy/src/Tests/Migrate/d7/MigrateTaxonomyVocabularyTest.php index e199238..8c748d8 100644 --- a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTaxonomyVocabularyTest.php +++ b/core/modules/taxonomy/src/Tests/Migrate/d7/MigrateTaxonomyVocabularyTest.php @@ -2,20 +2,21 @@ /** * @file - * Contains \Drupal\taxonomy\Tests\Migrate\d6\MigrateTaxonomyVocabularyTest. + * Contains \Drupal\taxonomy\Tests\Migrate\d7\MigrateTaxonomyVocabularyTest. */ -namespace Drupal\taxonomy\Tests\Migrate\d6; +namespace Drupal\taxonomy\Tests\Migrate\d7; +use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase; use Drupal\taxonomy\Entity\Vocabulary; -use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase; +use Drupal\taxonomy\VocabularyInterface; /** * Migrate taxonomy vocabularies to taxonomy.vocabulary.*.yml. * * @group taxonomy */ -class MigrateTaxonomyVocabularyTest extends MigrateDrupal6TestBase { +class MigrateTaxonomyVocabularyTest extends MigrateDrupal7TestBase { /** * Modules to enable. @@ -29,28 +30,27 @@ class MigrateTaxonomyVocabularyTest extends MigrateDrupal6TestBase { */ protected function setUp() { parent::setUp(); - $this->loadDumps(['Vocabulary.php', 'VocabularyNodeTypes.php']); - $this->executeMigration('d6_taxonomy_vocabulary'); + $this->loadDumps(['TaxonomyVocabulary.php']); + $this->executeMigration('d7_taxonomy_vocabulary'); + } + + protected function assertEntity($id, $expected_label, $expected_description, $expected_hierarchy, $expected_weight) { + /** @var \Drupal\taxonomy\VocabularyInterface $entity */ + $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')); } /** - * Tests the Drupal 6 taxonomy vocabularies to Drupal 8 migration. + * Tests the Drupal 7 taxonomy vocabularies to Drupal 8 migration. */ public function testTaxonomyVocabulary() { - for ($i = 0; $i < 3; $i++) { - $j = $i + 1; - $vocabulary = Vocabulary::load("vocabulary_{$j}_i_{$i}_"); - $this->assertIdentical(entity_load('migration', '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')); + $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); } } diff --git a/core/modules/taxonomy/tests/src/Unit/Migrate/d6/TermTest.php b/core/modules/taxonomy/tests/src/Unit/Migrate/d7/TermTest.php index 22a8312..a4c2ae9 100644 --- a/core/modules/taxonomy/tests/src/Unit/Migrate/d6/TermTest.php +++ b/core/modules/taxonomy/tests/src/Unit/Migrate/d7/TermTest.php @@ -2,16 +2,97 @@ /** * @file - * Contains \Drupal\Tests\taxonomy\Unit\Migrate\d6\TermTest. + * Contains \Drupal\Tests\taxonomy\Unit\Migrate\d7\TermTestBase. */ -namespace Drupal\Tests\taxonomy\Unit\Migrate\d6; +namespace Drupal\Tests\taxonomy\Unit\Migrate\d7; + +use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase; /** - * Tests D6 taxonomy term source plugin. + * Taxonomy term source unit test. * * @group taxonomy */ -class TermTest extends TermTestBase { +class TermTest extends MigrateSqlSourceTestCase { + + const PLUGIN_CLASS = 'Drupal\taxonomy\Plugin\migrate\source\d7\Term'; + + protected $migrationConfiguration = array( + 'id' => 'test', + 'highWaterProperty' => array('field' => 'test'), + 'idlist' => array(), + 'source' => array( + 'plugin' => 'd7_taxonomy_term', + ), + ); + + protected $expectedResults = array( + array( + 'tid' => 1, + 'vid' => 5, + 'name' => 'name value 1', + 'description' => 'description value 1', + 'weight' => 0, + 'parent' => array(0), + ), + array( + 'tid' => 2, + 'vid' => 6, + 'name' => 'name value 2', + 'description' => 'description value 2', + 'weight' => 0, + 'parent' => array(0), + ), + array( + 'tid' => 3, + 'vid' => 6, + 'name' => 'name value 3', + 'description' => 'description value 3', + 'weight' => 0, + 'parent' => array(0), + ), + array( + 'tid' => 4, + 'vid' => 5, + 'name' => 'name value 4', + 'description' => 'description value 4', + 'weight' => 1, + 'parent' => array(1), + ), + array( + 'tid' => 5, + 'vid' => 6, + 'name' => 'name value 5', + 'description' => 'description value 5', + 'weight' => 1, + 'parent' => array(2), + ), + array( + 'tid' => 6, + 'vid' => 6, + 'name' => 'name value 6', + 'description' => 'description value 6', + 'weight' => 0, + 'parent' => array(3, 2), + ), + ); + + /** + * {@inheritdoc} + */ + protected function setUp() { + foreach ($this->expectedResults as $k => $row) { + foreach ($row['parent'] as $parent) { + $this->databaseContents['taxonomy_term_hierarchy'][] = array( + 'tid' => $row['tid'], + 'parent' => $parent, + ); + } + unset($row['parent']); + $this->databaseContents['taxonomy_term_data'][$k] = $row; + } + parent::setUp(); + } } diff --git a/core/modules/taxonomy/tests/src/Unit/Migrate/d6/VocabularyTest.php b/core/modules/taxonomy/tests/src/Unit/Migrate/d7/VocabularyTest.php index 53ea004..27e6f2d 100644 --- a/core/modules/taxonomy/tests/src/Unit/Migrate/d6/VocabularyTest.php +++ b/core/modules/taxonomy/tests/src/Unit/Migrate/d7/VocabularyTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Tests\taxonomy\Unit\Migrate\d6\VocabularyTest. + * Contains \Drupal\Tests\taxonomy\Unit\Migrate\d7\VocabularyTest. */ -namespace Drupal\Tests\taxonomy\Unit\Migrate\d6; +namespace Drupal\Tests\taxonomy\Unit\Migrate\d7; use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase; @@ -16,64 +16,45 @@ */ class VocabularyTest extends MigrateSqlSourceTestCase { - const PLUGIN_CLASS = 'Drupal\taxonomy\Plugin\migrate\source\d6\Vocabulary'; + const PLUGIN_CLASS = 'Drupal\taxonomy\Plugin\migrate\source\d7\Vocabulary'; // The fake Migration configuration entity. - protected $migrationConfiguration = [ + protected $migrationConfiguration = array( // The ID of the entity, can be any string. 'id' => 'test', // Leave it empty for now. - 'idlist' => [], - 'source' => [ - 'plugin' => 'd6_vocabulary', - ], - ]; - - protected $expectedResults = [ - [ + 'idlist' => array(), + 'source' => array( + 'plugin' => 'd7_vocabulary', + ), + ); + + protected $expectedResults = array( + array( 'vid' => 1, 'name' => 'Tags', + 'machine_name' => 'tags', 'description' => 'Tags description.', - 'help' => 1, - 'relations' => 0, 'hierarchy' => 0, - 'multiple' => 0, - 'required' => 0, - 'tags' => 1, 'module' => 'taxonomy', 'weight' => 0, - 'node_types' => ['page', 'article'], - ], - [ + ), + array( 'vid' => 2, 'name' => 'Categories', + 'machine_name' => 'categories', 'description' => 'Categories description.', - 'help' => 1, - 'relations' => 1, 'hierarchy' => 1, - 'multiple' => 0, - 'required' => 1, - 'tags' => 0, 'module' => 'taxonomy', 'weight' => 0, - 'node_types' => ['article'], - ], - ]; + ), + ); /** * {@inheritdoc} */ protected function setUp() { - foreach ($this->expectedResults as &$row) { - foreach ($row['node_types'] as $type) { - $this->databaseContents['vocabulary_node_types'][] = [ - 'type' => $type, - 'vid' => $row['vid'], - ]; - } - unset($row['node_types']); - } - $this->databaseContents['vocabulary'] = $this->expectedResults; + $this->databaseContents['taxonomy_vocabulary'] = $this->expectedResults; parent::setUp(); }