You are here

public function LayoutEntityHelperTraitTest::providerTestIsEntityUsingFieldOverride in Drupal 8

Dataprovider for testIsEntityUsingFieldOverride().

File

core/modules/layout_builder/tests/src/Unit/LayoutEntityHelperTraitTest.php, line 40

Class

LayoutEntityHelperTraitTest
@coversDefaultClass \Drupal\layout_builder\LayoutEntityHelperTrait

Namespace

Drupal\Tests\layout_builder\Unit

Code

public function providerTestIsEntityUsingFieldOverride() {
  $data['non fieldable entity'] = [
    $this
      ->prophesize(EntityInterface::class)
      ->reveal(),
    FALSE,
  ];
  $fieldable_entity = $this
    ->prophesize(FieldableEntityInterface::class);
  $fieldable_entity
    ->hasField(OverridesSectionStorage::FIELD_NAME)
    ->willReturn(FALSE);
  $data['fieldable entity without layout field'] = [
    $fieldable_entity
      ->reveal(),
    FALSE,
  ];
  $entity_using_field = $this
    ->prophesize(FieldableEntityInterface::class);
  $entity_using_field
    ->hasField(OverridesSectionStorage::FIELD_NAME)
    ->willReturn(TRUE);
  $data['fieldable entity with layout field'] = [
    $entity_using_field
      ->reveal(),
    TRUE,
  ];
  return $data;
}