You are here

public function FieldDiscoveryTest::testGetEntityFields in Drupal 9

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

Tests the protected getEntityFields method.

@covers ::getEntityFields @dataProvider getEntityFieldsData

Parameters

string $entity_type_id: The entity type ID.

array $expected_fields: The expected fields.

File

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

Class

FieldDiscoveryTest
Tests the FieldDiscovery Class.

Namespace

Drupal\Tests\migrate_drupal\Unit

Code

public function testGetEntityFields($entity_type_id, array $expected_fields) {
  $test_data = [
    'getAllFields' => [
      '7' => $this
        ->getAllFieldData(),
    ],
  ];
  $field_discovery = new FieldDiscoveryTestClass($this->fieldPluginManager
    ->reveal(), $this->migrationPluginManager
    ->reveal(), $this->logger
    ->reveal(), $test_data);
  $actual_fields = $field_discovery
    ->getEntityFields('7', $entity_type_id);
  $this
    ->assertSame($expected_fields, $actual_fields);
}