You are here

public function FieldDiscoveryTest::getBundleFieldsData in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php \Drupal\Tests\migrate_drupal\Unit\FieldDiscoveryTest::getBundleFieldsData()
  2. 10 core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php \Drupal\Tests\migrate_drupal\Unit\FieldDiscoveryTest::getBundleFieldsData()

Provides data for testGetBundleFields.

Return value

array The data.

File

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

Class

FieldDiscoveryTest
Tests the FieldDiscovery Class.

Namespace

Drupal\Tests\migrate_drupal\Unit

Code

public function getBundleFieldsData() {
  return [
    'Node - Content Type 1' => [
      'entity_type_id' => 'node',
      'bundle' => 'content_type_1',
      'expected_fields' => [
        'field_1' => [
          'field_info_key' => 'field_1_data',
        ],
        'field_2' => [
          'field_info_key' => 'field_2_data',
        ],
        'field_3' => [
          'field_info_key' => 'field_3_data',
        ],
      ],
    ],
    'Node - Content Type 2' => [
      'entity_type_id' => 'node',
      'bundle' => 'content_type_2',
      'expected_fields' => [
        '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',
      'bundle' => 'user',
      'expected_fields' => [
        'user_field_1' => [
          'field_info_key' => 'user_field_1_data',
        ],
      ],
    ],
    'Comment - Content Type 1' => [
      'entity_type_id' => 'comment',
      'bundle' => 'comment_node_content_type_1',
      'expected_fields' => [
        'cfield_1' => [
          'field_info_key' => 'field_1_data',
        ],
        'cfield_2' => [
          'field_info_key' => 'field_2_data',
        ],
        'cfield_3' => [
          'field_info_key' => 'field_3_data',
        ],
      ],
    ],
    'Comment - Content Type 2' => [
      'entity_type_id' => 'comment',
      'bundle' => 'comment_node_content_type_2',
      'expected_fields' => [
        'cfield_1' => [
          'field_info_key' => 'field_1_data',
        ],
        'cfield_4' => [
          'field_info_key' => 'field_4_data',
        ],
        'cfield_5' => [
          'field_info_key' => 'field_5_data',
        ],
      ],
    ],
    'Non-existent Entity Type' => [
      'entity_type_id' => 'custom_entity',
      'bundle' => 'content_type_1',
      'expected_fields' => [],
    ],
    'Non-existent Bundle' => [
      'entity_type_id' => 'node',
      'bundle' => 'content_type_3',
      'expected_fields' => [],
    ],
  ];
}