function ContentEntityBaseUnitTest::providerGetFields

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php \Drupal\Tests\Core\Entity\ContentEntityBaseUnitTest::providerGetFields()
  2. 8.9.x core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php \Drupal\Tests\Core\Entity\ContentEntityBaseUnitTest::providerGetFields()
  3. 11.x core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php \Drupal\Tests\Core\Entity\ContentEntityBaseUnitTest::providerGetFields()

Data provider for testGetFields().

Return value

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 600

Class

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

Namespace

Drupal\Tests\Core\Entity

Code

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

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