You are here

public function FieldDiscoveryTest::testGetBundleFields 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::testGetBundleFields()
  2. 10 core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php \Drupal\Tests\migrate_drupal\Unit\FieldDiscoveryTest::testGetBundleFields()

Tests the protected getEntityFields method.

@covers ::getBundleFields @dataProvider getBundleFieldsData

Parameters

string $entity_type_id: The entity type ID.

string $bundle: The bundle.

array $expected_fields: The expected fields.

File

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

Class

FieldDiscoveryTest
Tests the FieldDiscovery Class.

Namespace

Drupal\Tests\migrate_drupal\Unit

Code

public function testGetBundleFields($entity_type_id, $bundle, 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
    ->getBundleFields('7', $entity_type_id, $bundle);
  $this
    ->assertSame($expected_fields, $actual_fields);
}