function MigrateTaxonomyTermTest::testTaxonomyTerms
Same name in this branch
- 8.9.x core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d6\MigrateTaxonomyTermTest::testTaxonomyTerms()
Same name in other branches
- 9 core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d6\MigrateTaxonomyTermTest::testTaxonomyTerms()
- 9 core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d7\MigrateTaxonomyTermTest::testTaxonomyTerms()
- 10 core/modules/forum/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTest.php \Drupal\Tests\forum\Kernel\Migrate\d6\MigrateTaxonomyTermTest::testTaxonomyTerms()
- 10 core/modules/forum/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php \Drupal\Tests\forum\Kernel\Migrate\d7\MigrateTaxonomyTermTest::testTaxonomyTerms()
- 10 core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d6\MigrateTaxonomyTermTest::testTaxonomyTerms()
- 10 core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d7\MigrateTaxonomyTermTest::testTaxonomyTerms()
- 11.x core/modules/forum/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTest.php \Drupal\Tests\forum\Kernel\Migrate\d6\MigrateTaxonomyTermTest::testTaxonomyTerms()
- 11.x core/modules/forum/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php \Drupal\Tests\forum\Kernel\Migrate\d7\MigrateTaxonomyTermTest::testTaxonomyTerms()
- 11.x core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d6\MigrateTaxonomyTermTest::testTaxonomyTerms()
- 11.x core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d7\MigrateTaxonomyTermTest::testTaxonomyTerms()
Tests the Drupal 7 taxonomy term to Drupal 8 migration.
File
-
core/
modules/ taxonomy/ tests/ src/ Kernel/ Migrate/ d7/ MigrateTaxonomyTermTest.php, line 109
Class
- MigrateTaxonomyTermTest
- Upgrade taxonomy terms.
Namespace
Drupal\Tests\taxonomy\Kernel\Migrate\d7Code
public function testTaxonomyTerms() {
$this->assertEntity(1, 'en', 'General discussion', 'forums', '', NULL, 2);
// Tests that terms that used the Drupal 7 Title module and that have their
// name and description replaced by real fields are correctly migrated.
$this->assertEntity(2, 'en', 'Term1 (This is a real field!)', 'test_vocabulary', 'The first term. (This is a real field!)', 'filtered_html', 0, [], NULL, 3);
$this->assertEntity(3, 'en', 'Term2', 'test_vocabulary', 'The second term.', 'filtered_html');
$this->assertEntity(4, 'en', 'Term3 in plain old English', 'test_vocabulary', 'The third term in plain old English.', 'full_html', 0, [
3,
], 6);
$this->assertEntity(5, 'en', 'Custom Forum', 'forums', 'Where the cool kids are.', NULL, 3);
$this->assertEntity(6, 'en', 'Games', 'forums', NULL, '', 4, []);
$this->assertEntity(7, 'en', 'Minecraft', 'forums', '', NULL, 1, [
6,
]);
$this->assertEntity(8, 'en', 'Half Life 3', 'forums', '', NULL, 0, [
6,
]);
// Verify that we still can create forum containers after the migration.
$term = Term::create([
'vid' => 'forums',
'name' => 'Forum Container',
'forum_container' => 1,
]);
$term->save();
// Reset the forums tree data so this new term is included in the tree.
unset($this->treeData['forums']);
$this->assertEntity(25, 'en', 'Forum Container', 'forums', '', '', 0, [], NULL, NULL, 1);
// Test taxonomy term language translations.
$this->assertEntity(19, 'en', 'Jupiter Station', 'vocablocalized', 'Holographic research.', 'filtered_html', 0, [], NULL, NULL, 1);
$this->assertEntity(20, 'en', 'DS9', 'vocablocalized', 'Terok Nor', 'filtered_html', 0, [], NULL, NULL, 1);
$this->assertEntity(21, 'en', 'High council', 'vocabtranslate', NULL, NULL, 0, [], NULL, NULL, 1);
$this->assertEntity(22, 'fr', 'fr - High council', 'vocabtranslate', NULL, NULL, 0, [], NULL, NULL, 1);
$this->assertEntity(23, 'is', 'is - High council', 'vocabtranslate', NULL, NULL, 0, [], NULL, NULL, 1);
$this->assertEntity(24, 'fr', 'FR - Crewman', 'vocabfixed', NULL, NULL, 0, [], NULL, NULL, 1);
// Localized.
$this->assertEntity(19, 'en', 'Jupiter Station', 'vocablocalized', 'Holographic research.', 'filtered_html', '0', []);
$this->assertEntity(20, 'en', 'DS9', 'vocablocalized', 'Terok Nor', 'filtered_html', '0', []);
/** @var \Drupal\taxonomy\TermInterface $entity */
$entity = Term::load(20);
$this->assertSame('Bajor', $entity->field_sector->value);
// Translate.
$this->assertEntity(21, 'en', 'High council', 'vocabtranslate', NULL, NULL, '0', []);
$entity = Term::load(21);
$this->assertSame("K'mpec", $entity->field_chancellor->value);
$this->assertEntity(22, 'fr', 'fr - High council', 'vocabtranslate', NULL, NULL, '0', []);
$this->assertEntity(23, 'is', 'is - High council', 'vocabtranslate', NULL, NULL, '0', []);
// Fixed.
$this->assertEntity(24, 'fr', 'FR - Crewman', 'vocabfixed', NULL, NULL, '0', []);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.