function FieldLayoutBuilderTest::testBuildFormNoLayout

Same name in other branches
  1. 9 core/modules/field_layout/tests/src/Unit/FieldLayoutBuilderTest.php \Drupal\Tests\field_layout\Unit\FieldLayoutBuilderTest::testBuildFormNoLayout()
  2. 8.9.x core/modules/field_layout/tests/src/Unit/FieldLayoutBuilderTest.php \Drupal\Tests\field_layout\Unit\FieldLayoutBuilderTest::testBuildFormNoLayout()
  3. 11.x 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 311

Class

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

Namespace

Drupal\Tests\field_layout\Unit

Code

public function testBuildFormNoLayout() : void {
    $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);
}

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