You are here

public function MigrateEckFieldTest::testFields in Entity Construction Kit (ECK) 8

Tests migrating D7 fields to field_storage_config entities.

File

tests/src/Kernel/Migrate/d7/MigrateEckFieldTest.php, line 40

Class

MigrateEckFieldTest
Migrates Drupal 7 fields.

Namespace

Drupal\Tests\eck\Kernel\Migrate\d7

Code

public function testFields() {
  $this
    ->assertFieldStorage('complex_entity.field_complex_entity', 'entity_reference', TRUE, 1);
  $this
    ->assertFieldStorage('complex_entity.field_node', 'entity_reference', TRUE, 1);
  $this
    ->assertFieldStorage('complex_entity.field_simple_entities', 'entity_reference', TRUE, -1);
  $this
    ->assertFieldStorage('complex_entity.field_text', 'string', TRUE, 1);
  $this
    ->assertFieldStorage('node.body', 'text_with_summary', TRUE, 1);
  $this
    ->assertFieldStorage('simple_entity.field_text', 'string', TRUE, 1);

  // Assert that the entityreference fields are referencing the correct
  // entity type.
  $field = FieldStorageConfig::load('complex_entity.field_complex_entity');
  $this
    ->assertEquals('complex_entity', $field
    ->getSetting('target_type'));
  $field = FieldStorageConfig::load('complex_entity.field_node');
  $this
    ->assertEquals('node', $field
    ->getSetting('target_type'));
  $field = FieldStorageConfig::load('complex_entity.field_simple_entities');
  $this
    ->assertEquals('simple_entity', $field
    ->getSetting('target_type'));
}