View source
<?php
namespace Drupal\Tests\eck\Kernel\Migrate\d7;
use Drupal\field\Entity\FieldStorageConfig;
class MigrateEckFieldTest extends MigrateEckTestBase {
public static $modules = [
'comment',
'eck',
'entity_reference',
'node',
'text',
];
protected function setUp() {
parent::setUp();
$this
->installConfig(static::$modules);
$this
->executeMigrations([
'd7_eck_type',
'd7_field',
]);
}
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);
$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'));
}
}