public function MigrateFieldTest::testFields in Zircon Profile 8
Same name in this branch
- 8 core/modules/field/src/Tests/Migrate/d6/MigrateFieldTest.php \Drupal\field\Tests\Migrate\d6\MigrateFieldTest::testFields()
- 8 core/modules/field/src/Tests/Migrate/d7/MigrateFieldTest.php \Drupal\field\Tests\Migrate\d7\MigrateFieldTest::testFields()
Same name and namespace in other branches
- 8.0 core/modules/field/src/Tests/Migrate/d7/MigrateFieldTest.php \Drupal\field\Tests\Migrate\d7\MigrateFieldTest::testFields()
Tests migrating D7 fields to field_storage_config entities.
File
- core/
modules/ field/ src/ Tests/ Migrate/ d7/ MigrateFieldTest.php, line 86 - Contains \Drupal\field\Tests\Migrate\d7\MigrateFieldTest.
Class
- MigrateFieldTest
- Migrates Drupal 7 fields.
Namespace
Drupal\field\Tests\Migrate\d7Code
public function testFields() {
$this
->assertEntity('node.body', 'text_with_summary', FALSE, 1);
$this
->assertEntity('node.field_long_text', 'text_with_summary', FALSE, 1);
$this
->assertEntity('comment.comment_body', 'text_long', FALSE, 1);
$this
->assertEntity('node.field_file', 'file', FALSE, 1);
$this
->assertEntity('user.field_file', 'file', FALSE, 1);
$this
->assertEntity('node.field_float', 'float', FALSE, 1);
$this
->assertEntity('node.field_image', 'image', FALSE, 1);
$this
->assertEntity('node.field_images', 'image', FALSE, 1);
$this
->assertEntity('node.field_integer', 'integer', FALSE, 1);
$this
->assertEntity('comment.field_integer', 'integer', FALSE, 1);
$this
->assertEntity('node.field_integer_list', 'list_integer', FALSE, 1);
$this
->assertEntity('node.field_link', 'link', FALSE, 1);
$this
->assertEntity('node.field_tags', 'entity_reference', FALSE, -1);
$this
->assertEntity('node.field_term_reference', 'entity_reference', FALSE, 1);
$this
->assertEntity('node.taxonomy_forums', 'entity_reference', FALSE, 1);
$this
->assertEntity('node.field_text', 'text', FALSE, 1);
$this
->assertEntity('node.field_text_list', 'list_string', FALSE, 3);
$this
->assertEntity('node.field_boolean', 'boolean', FALSE, 1);
$this
->assertEntity('node.field_email', 'email', FALSE, -1);
$this
->assertEntity('node.field_phone', 'telephone', FALSE, 1);
$this
->assertEntity('node.field_date', 'datetime', FALSE, 1);
$this
->assertEntity('node.field_date_with_end_time', 'datetime', FALSE, 1);
// Assert that the taxonomy term reference fields are referencing the
// correct entity type.
$field = FieldStorageConfig::load('node.field_term_reference');
$this
->assertIdentical('taxonomy_term', $field
->getSetting('target_type'));
$field = FieldStorageConfig::load('node.taxonomy_forums');
$this
->assertIdentical('taxonomy_term', $field
->getSetting('target_type'));
// Validate that the source count and processed count match up.
/** @var \Drupal\migrate\Entity\MigrationInterface $migration */
$migration = Migration::load('d7_field');
$this
->assertIdentical($migration
->getSourcePlugin()
->count(), $migration
->getIdMap()
->processedCount());
}