You are here

public function ContentEntityBaseUnitTest::providerGet in Drupal 10

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

Data provider for testGet().

@returns

  • 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 530

Class

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

Namespace

Drupal\Tests\Core\Entity

Code

public 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',
      [],
    ],
  ];
}