function FieldDiscoveryTest::getEntityFieldsData

Same name in other branches
  1. 9 core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php \Drupal\Tests\migrate_drupal\Unit\FieldDiscoveryTest::getEntityFieldsData()
  2. 8.9.x core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php \Drupal\Tests\migrate_drupal\Unit\FieldDiscoveryTest::getEntityFieldsData()
  3. 10 core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php \Drupal\Tests\migrate_drupal\Unit\FieldDiscoveryTest::getEntityFieldsData()

Provides data for testGetEntityFields.

Return value

array The data.

File

core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php, line 82

Class

FieldDiscoveryTest
Tests the FieldDiscovery Class.

Namespace

Drupal\Tests\migrate_drupal\Unit

Code

public static function getEntityFieldsData() {
    return [
        'Node' => [
            'entity_type_id' => 'node',
            'expected_fields' => [
                'content_type_1' => [
                    'field_1' => [
                        'field_info_key' => 'field_1_data',
                    ],
                    'field_2' => [
                        'field_info_key' => 'field_2_data',
                    ],
                    'field_3' => [
                        'field_info_key' => 'field_3_data',
                    ],
                ],
                'content_type_2' => [
                    'field_1' => [
                        'field_info_key' => 'field_1_data',
                    ],
                    'field_4' => [
                        'field_info_key' => 'field_4_data',
                    ],
                    'field_5' => [
                        'field_info_key' => 'field_5_data',
                    ],
                ],
            ],
        ],
        'User' => [
            'entity_type_id' => 'user',
            'expected_fields' => [
                'user' => [
                    'user_field_1' => [
                        'field_info_key' => 'user_field_1_data',
                    ],
                ],
            ],
        ],
        'Comment' => [
            'entity_type_id' => 'comment',
            'expected_fields' => [
                'comment_node_content_type_1' => [
                    'comment_field_1' => [
                        'field_info_key' => 'field_1_data',
                    ],
                    'comment_field_2' => [
                        'field_info_key' => 'field_2_data',
                    ],
                    'comment_field_3' => [
                        'field_info_key' => 'field_3_data',
                    ],
                ],
                'comment_node_content_type_2' => [
                    'comment_field_1' => [
                        'field_info_key' => 'field_1_data',
                    ],
                    'comment_field_4' => [
                        'field_info_key' => 'field_4_data',
                    ],
                    'comment_field_5' => [
                        'field_info_key' => 'field_5_data',
                    ],
                ],
            ],
        ],
        'Non-existent Entity' => [
            'entity_type_id' => 'custom_entity',
            'expected_fields' => [],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.