public function MigrateEckTest::testEck in Entity Construction Kit (ECK) 8
Tests migrating Eck entity types.
File
- tests/
src/ Kernel/ Migrate/ d7/ MigrateEckTest.php, line 56
Class
- MigrateEckTest
- Tests migration of ECK entities.
Namespace
Drupal\Tests\eck\Kernel\Migrate\d7Code
public function testEck() {
$results = [
[
'type' => 'simple_entity',
'bundle' => 'simple_entity',
'id' => 1,
'label' => 'Simple entity 1',
'langcode' => 'und',
'fields' => [
'field_text' => [
0 => [
'value' => 'Simple entity 1 text value.',
],
],
],
],
[
'type' => 'complex_entity',
'bundle' => 'complex_entity',
'id' => '1',
'label' => 'Complex entity 1',
'langcode' => 'en',
'fields' => [
'field_text' => [
0 => [
'value' => 'Complex entity text value - English version.',
],
],
'field_complex_entity' => [
0 => [
'target_id' => '3',
],
],
'field_file' => [
0 => [
'target_id' => '1',
'display' => '1',
'description' => '',
],
],
'field_node' => [
0 => [
'target_id' => '1',
],
],
'field_simple_entities' => [
0 => [
'target_id' => '1',
],
1 => [
'target_id' => '2',
],
],
],
'translations' => [
'fr' => [
'fields' => [
'field_text' => [
0 => [
'value' => 'Complex entity text value - French version.',
],
],
],
],
],
],
[
'type' => 'complex_entity',
'bundle' => 'complex_entity',
'id' => '3',
'label' => 'Complex entity 3',
'langcode' => 'fr',
'fields' => [
'field_text' => [
0 => [
'value' => 'Complex entity 3 text value - French version.',
],
],
],
],
[
'type' => 'complex_entity',
'bundle' => 'another_bundle',
'id' => '4',
'label' => 'Entity of another complex bundle 1',
'langcode' => 'en',
'fields' => [
'field_text' => [
0 => [
'value' => 'Text value of another complex bundle 1.',
],
],
],
],
];
$count = \Drupal::entityQuery('simple_entity')
->accessCheck(FALSE)
->count()
->execute();
$this
->assertSame('2', $count);
$count = \Drupal::entityQuery('complex_entity')
->accessCheck(FALSE)
->count()
->execute();
$this
->assertSame('5', $count);
foreach ($results as $result) {
$this
->assertEck($result);
}
}