diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/process/FieldNamePrefix.php b/core/modules/migrate_drupal/src/Plugin/migrate/process/FieldNamePrefix.php new file mode 100644 index 0000000..f12cee8 --- /dev/null +++ b/core/modules/migrate_drupal/src/Plugin/migrate/process/FieldNamePrefix.php @@ -0,0 +1,32 @@ +assertSame("{$language}term {$tid} of vocabulary {$values['source_vid']}", $term->name->value); $this->assertSame("{$language}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); + $this->assertSame($values['vid'], $term->vid->target_id); + $this->assertSame((string) $values['weight'], $term->weight->value); if ($values['parent'] === [0]) { $this->assertNull($term->parent->target_id); } @@ -99,7 +99,7 @@ public function testTaxonomyTerms() { foreach (\Drupal::entityManager()->getStorage('taxonomy_term')->loadParents($tid) as $parent) { $parents[] = (int) $parent->id(); } - $this->assertIdentical($parents, $values['parent']); + $this->assertSame($parents, $values['parent']); } $this->assertArrayHasKey($tid, $tree_terms, "Term $tid exists in vocabulary tree"); diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyVocabularyTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyVocabularyTest.php index 6c66598..79e188b 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyVocabularyTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyVocabularyTest.php @@ -32,17 +32,17 @@ public function testTaxonomyVocabulary() { for ($i = 0; $i < 3; $i++) { $j = $i + 1; $vocabulary = Vocabulary::load("vocabulary_{$j}_i_{$i}_"); - $this->assertIdentical($this->getMigration('d6_taxonomy_vocabulary')->getIdMap()->lookupDestinationID([$j]), [$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')); + $this->assertSame($this->getMigration('d6_taxonomy_vocabulary')->getIdMap()->lookupDestinationID([$j]), [$vocabulary->id()]); + $this->assertSame("vocabulary $j (i=$i)", $vocabulary->label()); + $this->assertSame("description of vocabulary $j (i=$i)", $vocabulary->getDescription()); + $this->assertSame($i, $vocabulary->getHierarchy()); + $this->assertSame(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->assertSame('vocabulary name much longer than thirty two characters', $vocabulary->label()); + $this->assertSame('description of vocabulary name much longer than thirty two characters', $vocabulary->getDescription()); + $this->assertSame(3, $vocabulary->getHierarchy()); + $this->assertSame(7, $vocabulary->get('weight')); } } diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php index e49f607..614725d 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php @@ -32,9 +32,9 @@ protected function setUp() { */ public function testTermRevisionNode() { $node = \Drupal::entityManager()->getStorage('node')->loadRevision(2); - $this->assertIdentical(2, count($node->field_vocabulary_3_i_2_)); - $this->assertIdentical('4', $node->field_vocabulary_3_i_2_[0]->target_id); - $this->assertIdentical('5', $node->field_vocabulary_3_i_2_[1]->target_id); + $this->assertSame(2, count($node->field_vocabulary_3_i_2_)); + $this->assertSame('4', $node->field_vocabulary_3_i_2_[0]->target_id); + $this->assertSame('5', $node->field_vocabulary_3_i_2_[1]->target_id); } } diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTest.php index 1625800..8e7d13d 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTest.php @@ -40,12 +40,12 @@ public function testTermNode() { $nodes = Node::loadMultiple([1, 2]); $node = $nodes[1]; - $this->assertIdentical(1, count($node->field_vocabulary_1_i_0_)); - $this->assertIdentical('1', $node->field_vocabulary_1_i_0_[0]->target_id); + $this->assertSame(1, count($node->field_vocabulary_1_i_0_)); + $this->assertSame('1', $node->field_vocabulary_1_i_0_[0]->target_id); $node = $nodes[2]; - $this->assertIdentical(2, count($node->field_vocabulary_2_i_1_)); - $this->assertIdentical('2', $node->field_vocabulary_2_i_1_[0]->target_id); - $this->assertIdentical('3', $node->field_vocabulary_2_i_1_[1]->target_id); + $this->assertSame(2, count($node->field_vocabulary_2_i_1_)); + $this->assertSame('2', $node->field_vocabulary_2_i_1_[0]->target_id); + $this->assertSame('3', $node->field_vocabulary_2_i_1_[1]->target_id); } /** diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyEntityDisplayTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyEntityDisplayTest.php index f121b1a..5b8a638 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyEntityDisplayTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyEntityDisplayTest.php @@ -42,10 +42,10 @@ public function testVocabularyEntityDisplay() { // Test that the field exists. $component = EntityViewDisplay::load('node.page.default')->getComponent('field_tags'); - $this->assertIdentical('entity_reference_label', $component['type']); - $this->assertIdentical(20, $component['weight']); + $this->assertSame('entity_reference_label', $component['type']); + $this->assertSame(20, $component['weight']); // Test the Id map. - $this->assertIdentical(['node', 'article', 'default', 'field_tags'], $this->getMigration('d6_vocabulary_entity_display')->getIdMap()->lookupDestinationID([4, 'article'])); + $this->assertSame(['node', 'article', 'default', 'field_tags'], $this->getMigration('d6_vocabulary_entity_display')->getIdMap()->lookupDestinationID([4, 'article'])); // Tests that a vocabulary named like a D8 base field will be migrated and // prefixed with 'field_' to avoid conflicts. diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyEntityFormDisplayTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyEntityFormDisplayTest.php index ad64522..2c96e51 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyEntityFormDisplayTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyEntityFormDisplayTest.php @@ -42,15 +42,15 @@ public function testVocabularyEntityFormDisplay() { // Test that the field exists. $component = EntityFormDisplay::load('node.page.default')->getComponent('field_tags'); - $this->assertIdentical('options_select', $component['type']); - $this->assertIdentical(20, $component['weight']); + $this->assertSame('options_select', $component['type']); + $this->assertSame(20, $component['weight']); // Test the Id map. - $this->assertIdentical(['node', 'article', 'default', 'field_tags'], $this->getMigration('d6_vocabulary_entity_form_display')->getIdMap()->lookupDestinationID([4, 'article'])); + $this->assertSame(['node', 'article', 'default', 'field_tags'], $this->getMigration('d6_vocabulary_entity_form_display')->getIdMap()->lookupDestinationID([4, 'article'])); // Test the term widget tags setting. $entity_form_display = EntityFormDisplay::load('node.story.default'); - $this->assertIdentical($entity_form_display->getComponent('field_vocabulary_1_i_0_')['type'], 'options_select'); - $this->assertIdentical($entity_form_display->getComponent('field_vocabulary_2_i_1_')['type'], 'entity_reference_autocomplete_tags'); + $this->assertSame($entity_form_display->getComponent('field_vocabulary_1_i_0_')['type'], 'options_select'); + $this->assertSame($entity_form_display->getComponent('field_vocabulary_2_i_1_')['type'], 'entity_reference_autocomplete_tags'); // Tests that a vocabulary named like a D8 base field will be migrated and // prefixed with 'field_' to avoid conflicts. diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldInstanceTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldInstanceTest.php index 8814e60..26cd7f5 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldInstanceTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldInstanceTest.php @@ -42,23 +42,23 @@ public function testVocabularyFieldInstance() { // Test that the field exists. $field_id = 'node.article.field_tags'; $field = FieldConfig::load($field_id); - $this->assertIdentical($field_id, $field->id(), 'Field instance exists on article bundle.'); - $this->assertIdentical('Tags', $field->label()); + $this->assertSame($field_id, $field->id(), 'Field instance exists on article bundle.'); + $this->assertSame('Tags', $field->label()); $this->assertTrue($field->isRequired(), 'Field is required'); // Test the page bundle as well. $field_id = 'node.page.field_tags'; $field = FieldConfig::load($field_id); - $this->assertIdentical($field_id, $field->id(), 'Field instance exists on page bundle.'); - $this->assertIdentical('Tags', $field->label()); + $this->assertSame($field_id, $field->id(), 'Field instance exists on page bundle.'); + $this->assertSame('Tags', $field->label()); $this->assertTrue($field->isRequired(), 'Field is required'); $settings = $field->getSettings(); - $this->assertIdentical('default:taxonomy_term', $settings['handler'], 'The handler plugin ID is correct.'); - $this->assertIdentical(['field_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->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->assertIdentical(['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_. $field_id = 'node.story.field_vocabulary_1_i_0_'; diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldTest.php index caa034b..d294ec4 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldTest.php @@ -33,13 +33,13 @@ public function testVocabularyField() { $field_storage_id = 'node.field_tags'; /** @var \Drupal\field\FieldStorageConfigInterface $field_storage */ $field_storage = FieldStorageConfig::load($field_storage_id); - $this->assertIdentical($field_storage_id, $field_storage->id()); + $this->assertSame($field_storage_id, $field_storage->id()); $settings = $field_storage->getSettings(); - $this->assertIdentical('taxonomy_term', $settings['target_type'], "Target type is correct."); - $this->assertIdentical(1, $field_storage->getCardinality(), "Field cardinality in 1."); + $this->assertSame('taxonomy_term', $settings['target_type'], "Target type is correct."); + $this->assertSame(1, $field_storage->getCardinality(), "Field cardinality in 1."); - $this->assertIdentical(['node', 'field_tags'], $this->getMigration('d6_vocabulary_field')->getIdMap()->lookupDestinationID([4]), "Test IdMap"); + $this->assertSame(['node', 'field_tags'], $this->getMigration('d6_vocabulary_field')->getIdMap()->lookupDestinationID([4]), "Test IdMap"); // Tests that a vocabulary named like a D8 base field will be migrated and // prefixed with 'field_' to avoid conflicts.