X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Ftaxonomy%2Ftests%2Fsrc%2FKernel%2FMigrate%2Fd6%2FMigrateVocabularyFieldInstanceTest.php;fp=web%2Fcore%2Fmodules%2Ftaxonomy%2Ftests%2Fsrc%2FKernel%2FMigrate%2Fd6%2FMigrateVocabularyFieldInstanceTest.php;h=c29e3d1e816f9ce62a0c0b6f619db2fe828acead;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=26cd7f581a4cf72cbf1c9a1f0f93277c96d3b6c9;hpb=74df008bdbb3a11eeea356744f39b802369bda3c;p=yaffs-website diff --git a/web/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldInstanceTest.php b/web/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldInstanceTest.php index 26cd7f581..c29e3d1e8 100644 --- a/web/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldInstanceTest.php +++ b/web/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldInstanceTest.php @@ -39,36 +39,55 @@ class MigrateVocabularyFieldInstanceTest extends MigrateDrupal6TestBase { public function testVocabularyFieldInstance() { $this->executeMigration('d6_vocabulary_field_instance'); - // Test that the field exists. + // Test that the field exists. Tags has a multilingual option of 'None'. $field_id = 'node.article.field_tags'; $field = FieldConfig::load($field_id); $this->assertSame($field_id, $field->id(), 'Field instance exists on article bundle.'); $this->assertSame('Tags', $field->label()); $this->assertTrue($field->isRequired(), 'Field is required'); + $this->assertFalse($field->isTranslatable()); - // Test the page bundle as well. + // Test the page bundle as well. Tags has a multilingual option of 'None'. $field_id = 'node.page.field_tags'; $field = FieldConfig::load($field_id); $this->assertSame($field_id, $field->id(), 'Field instance exists on page bundle.'); $this->assertSame('Tags', $field->label()); $this->assertTrue($field->isRequired(), 'Field is required'); + $this->assertFalse($field->isTranslatable()); $settings = $field->getSettings(); $this->assertSame('default:taxonomy_term', $settings['handler'], 'The handler plugin ID is correct.'); $this->assertSame(['field_tags'], $settings['handler_settings']['target_bundles'], 'The target_bundles handler setting is correct.'); $this->assertSame(TRUE, $settings['handler_settings']['auto_create'], 'The "auto_create" setting is correct.'); - $this->assertSame(['node', 'article', 'field_tags'], $this->getMigration('d6_vocabulary_field_instance')->getIdMap()->lookupDestinationID([4, 'article'])); + $this->assertSame(['node', 'article', 'field_tags'], $this->getMigration('d6_vocabulary_field_instance')->getIdMap()->lookupDestinationId([4, 'article'])); - // Test the the field vocabulary_1_i_0_. + // Test the the field vocabulary_1_i_0_ with multilingual option, + // 'per language terms'. $field_id = 'node.story.field_vocabulary_1_i_0_'; $field = FieldConfig::load($field_id); $this->assertFalse($field->isRequired(), 'Field is not required'); + $this->assertTrue($field->isTranslatable()); + + // Test the the field vocabulary_2_i_0_ with multilingual option, + // 'Set language to vocabulary'. + $field_id = 'node.story.field_vocabulary_2_i_1_'; + $field = FieldConfig::load($field_id); + $this->assertFalse($field->isRequired(), 'Field is not required'); + $this->assertFalse($field->isTranslatable()); + + // Test the the field vocabulary_3_i_0_ with multilingual option, + // 'Localize terms'. + $field_id = 'node.story.field_vocabulary_3_i_2_'; + $field = FieldConfig::load($field_id); + $this->assertFalse($field->isRequired(), 'Field is not required'); + $this->assertFalse($field->isTranslatable()); // Tests that a vocabulary named like a D8 base field will be migrated and // prefixed with 'field_' to avoid conflicts. $field_type = FieldConfig::load('node.sponsor.field_type'); $this->assertInstanceOf(FieldConfig::class, $field_type); + $this->assertFalse($field->isTranslatable()); } /**