You are here

private function LayoutSelectionTest::createLayoutForNodeType in Layout builder library 8

Creates a stored layout for a node type.

Parameters

string $node_type: The node type ID.

1 call to LayoutSelectionTest::createLayoutForNodeType()
LayoutSelectionTest::testReferenceableLayoutsFilteredByTargetBundle in tests/src/Functional/LayoutSelectionTest.php
Tests that reference-able layouts are filtered by target bundle.

File

tests/src/Functional/LayoutSelectionTest.php, line 72

Class

LayoutSelectionTest
Tests the functionality of the layout_selection field.

Namespace

Drupal\Tests\layout_library\Functional

Code

private function createLayoutForNodeType($node_type) {
  $page = $this
    ->getSession()
    ->getPage();
  $assert = $this
    ->assertSession();
  $this
    ->drupalGet('admin/structure/layouts');
  $page
    ->clickLink('Add layout');
  $page
    ->fillField('label', $node_type);
  $page
    ->fillField('id', $node_type);
  $page
    ->selectFieldOption('_entity_type', "node:{$node_type}");
  $page
    ->pressButton('Save');
  $assert
    ->pageTextContains("Edit layout for {$node_type}");
}