You are here

public function FieldLayoutBuilderTest::testBuildFormNoLayout in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/field_layout/tests/src/Unit/FieldLayoutBuilderTest.php \Drupal\Tests\field_layout\Unit\FieldLayoutBuilderTest::testBuildFormNoLayout()
  2. 9 core/modules/field_layout/tests/src/Unit/FieldLayoutBuilderTest.php \Drupal\Tests\field_layout\Unit\FieldLayoutBuilderTest::testBuildFormNoLayout()

@covers ::buildForm

File

core/modules/field_layout/tests/src/Unit/FieldLayoutBuilderTest.php, line 307

Class

FieldLayoutBuilderTest
@coversDefaultClass \Drupal\field_layout\FieldLayoutBuilder @group field_layout

Namespace

Drupal\Tests\field_layout\Unit

Code

public function testBuildFormNoLayout() {
  $this->entityFieldManager
    ->getFieldDefinitions(Argument::any(), Argument::any())
    ->shouldNotBeCalled();
  $build = [
    'test1' => [
      '#markup' => 'Test1',
    ],
  ];
  $display = $this
    ->prophesize(EntityDisplayWithLayoutInterface::class);
  $display
    ->getLayoutId()
    ->willReturn('unknown');
  $display
    ->getLayoutSettings()
    ->willReturn([]);
  $display
    ->getComponents()
    ->shouldNotBeCalled();
  $expected = [
    'test1' => [
      '#markup' => 'Test1',
    ],
  ];
  $this->fieldLayoutBuilder
    ->buildForm($build, $display
    ->reveal());
  $this
    ->assertSame($expected, $build);
}