You are here

public function FieldTargetEntityTest::providerTestTargetEntity in Twig Field Value 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Unit/FieldValue/FieldTargetEntityTest.php \Drupal\Tests\twig_field_value\Unit\FieldValue\FieldTargetEntityTest::providerTestTargetEntity()

Provides data and expected results for the test method.

Return value

array Data and expected results.

File

tests/src/Unit/FieldValue/FieldTargetEntityTest.php, line 75

Class

FieldTargetEntityTest
@coversDefaultClass \Drupal\twig_field_value\Twig\Extension\FieldValueExtension @group twig_field_value

Namespace

Drupal\Tests\twig_field_value\Unit\FieldValue

Code

public function providerTestTargetEntity() {
  return [
    // Invalid render arrays.
    [
      NULL,
      NULL,
    ],
    [
      NULL,
      [],
    ],
    [
      NULL,
      [
        '#theme' => 'field',
        '#no_field_name' => [],
      ],
    ],
    [
      NULL,
      [
        '#theme' => 'field',
        '#field_name' => [
          'reference_field',
        ],
      ],
    ],
    [
      'foo',
      [
        '#theme' => 'field',
        '#field_name' => [
          'reference_field',
        ],
        '#object' => $this
          ->mockContentEntity([
          'foo',
        ]),
      ],
    ],
    [
      [
        'entity_1',
        'entity_2',
        'entity_3',
      ],
      [
        '#theme' => 'field',
        '#field_name' => [
          'reference_field',
        ],
        '#object' => $this
          ->mockContentEntity([
          'entity_1',
          'entity_2',
          'entity_3',
        ]),
      ],
    ],
    [
      [
        'entity_1',
        'entity_2',
      ],
      [
        '#theme' => 'field',
        '#field_name' => [
          'reference_field',
        ],
        '#field_collection_item' => $this
          ->mockContentEntity([
          'entity_1',
          'entity_2',
        ]),
      ],
    ],
  ];
}