You are here

public function ContentEntityBaseUnitTest::providerGetFields in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php \Drupal\Tests\Core\Entity\ContentEntityBaseUnitTest::providerGetFields()

Data provider for testGetFields().

@returns array

  • Expected output from getFields().
  • $include_computed value to pass to getFields().
  • Value to mock from all field definitions for isComputed().
  • Array of field names to return from mocked getFieldDefinitions(). A Drupal\Core\Field\FieldDefinitionInterface object will be mocked for each name.

File

core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php, line 573

Class

ContentEntityBaseUnitTest
@coversDefaultClass \Drupal\Core\Entity\ContentEntityBase @group Entity @group Access

Namespace

Drupal\Tests\Core\Entity

Code

public function providerGetFields() {
  return [
    [
      [],
      FALSE,
      FALSE,
      [],
    ],
    [
      [
        'field' => 'field',
        'field2' => 'field2',
      ],
      TRUE,
      FALSE,
      [
        'field',
        'field2',
      ],
    ],
    [
      [
        'field3' => 'field3',
      ],
      TRUE,
      TRUE,
      [
        'field3',
      ],
    ],
    [
      [],
      FALSE,
      TRUE,
      [
        'field4',
      ],
    ],
  ];
}