function ContentEntityBaseUnitTest::providerGet

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

Data provider for testGet().

Return value

array

  • Expected output from get().
  • Field name parameter to get().
  • Language code for $activeLanguage.
  • Fields array for $fields.

File

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

Class

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

Namespace

Drupal\Tests\Core\Entity

Code

public static function providerGet() {
    return [
        // Populated fields array.
[
            'result',
            'field_name',
            'langcode',
            [
                'field_name' => [
                    'langcode' => 'result',
                ],
            ],
        ],
        // Incomplete fields array.
[
            'getTranslatedField_result',
            'field_name',
            'langcode',
            [
                'field_name' => 'no_langcode',
            ],
        ],
        // Empty fields array.
[
            'getTranslatedField_result',
            'field_name',
            'langcode',
            [],
        ],
    ];
}

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