function FieldLayoutBuilderTest::setUp

Same name and namespace in other branches
  1. 9 core/modules/field_layout/tests/src/Unit/FieldLayoutBuilderTest.php \Drupal\Tests\field_layout\Unit\FieldLayoutBuilderTest::setUp()
  2. 10 core/modules/field_layout/tests/src/Unit/FieldLayoutBuilderTest.php \Drupal\Tests\field_layout\Unit\FieldLayoutBuilderTest::setUp()
  3. 11.x core/modules/field_layout/tests/src/Unit/FieldLayoutBuilderTest.php \Drupal\Tests\field_layout\Unit\FieldLayoutBuilderTest::setUp()

Overrides UnitTestCase::setUp

File

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

Class

FieldLayoutBuilderTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21field_layout%21src%21FieldLayoutBuilder.php/class/FieldLayoutBuilder/8.9.x" title="Builds a field layout." class="local">\Drupal\field_layout\FieldLayoutBuilder</a> @group field_layout

Namespace

Drupal\Tests\field_layout\Unit

Code

protected function setUp() {
    parent::setUp();
    $this->pluginDefinition = new LayoutDefinition([
        'library' => 'field_layout/drupal.layout.twocol',
        'theme_hook' => 'layout__twocol',
        'regions' => [
            'left' => [
                'label' => 'Left',
            ],
            'right' => [
                'label' => 'Right',
            ],
        ],
    ]);
    $this->layoutPlugin = new LayoutDefault([], 'two_column', $this->pluginDefinition);
    $this->layoutPluginManager = $this->prophesize(LayoutPluginManagerInterface::class);
    $this->layoutPluginManager
        ->getDefinition('unknown', FALSE)
        ->willReturn(NULL);
    $this->layoutPluginManager
        ->getDefinition('two_column', FALSE)
        ->willReturn($this->pluginDefinition);
    $this->entityFieldManager = $this->prophesize(EntityFieldManagerInterface::class);
    $this->fieldLayoutBuilder = new FieldLayoutBuilder($this->layoutPluginManager
        ->reveal(), $this->entityFieldManager
        ->reveal());
}

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