public function MigrateVocabularyFieldInstanceTest::testVocabularyFieldInstance in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/taxonomy/src/Tests/Migrate/d6/MigrateVocabularyFieldInstanceTest.php \Drupal\taxonomy\Tests\Migrate\d6\MigrateVocabularyFieldInstanceTest::testVocabularyFieldInstance()
Tests the Drupal 6 vocabulary-node type association to Drupal 8 migration.
File
- core/
modules/ taxonomy/ src/ Tests/ Migrate/ d6/ MigrateVocabularyFieldInstanceTest.php, line 37 - Contains \Drupal\taxonomy\Tests\Migrate\d6\MigrateVocabularyFieldInstanceTest.
Class
- MigrateVocabularyFieldInstanceTest
- Vocabulary field instance migration.
Namespace
Drupal\taxonomy\Tests\Migrate\d6Code
public function testVocabularyFieldInstance() {
// Test that the field exists.
$field_id = 'node.article.tags';
$field = FieldConfig::load($field_id);
$this
->assertIdentical($field_id, $field
->id(), 'Field instance exists on article bundle.');
$this
->assertIdentical('Tags', $field
->label());
// Test the page bundle as well.
$field_id = 'node.page.tags';
$field = FieldConfig::load($field_id);
$this
->assertIdentical($field_id, $field
->id(), 'Field instance exists on page bundle.');
$this
->assertIdentical('Tags', $field
->label());
$settings = $field
->getSettings();
$this
->assertIdentical('default:taxonomy_term', $settings['handler'], 'The handler plugin ID is correct.');
$this
->assertIdentical([
'tags',
], $settings['handler_settings']['target_bundles'], 'The target_bundles handler setting is correct.');
$this
->assertIdentical(TRUE, $settings['handler_settings']['auto_create'], 'The "auto_create" setting is correct.');
$this
->assertIdentical(array(
'node',
'article',
'tags',
), Migration::load('d6_vocabulary_field_instance')
->getIdMap()
->lookupDestinationID(array(
4,
'article',
)));
}