You are here

public function LayoutSelectionTest::testReferenceableLayoutsFilteredByTargetBundle in Layout builder library 8

Tests that reference-able layouts are filtered by target bundle.

File

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

Class

LayoutSelectionTest
Tests the functionality of the layout_selection field.

Namespace

Drupal\Tests\layout_library\Functional

Code

public function testReferenceableLayoutsFilteredByTargetBundle() {
  $assert = $this
    ->assertSession();
  $account = $this
    ->drupalCreateUser([
    'configure any layout',
    'create alpha content',
    'create beta content',
    'administer node display',
  ]);
  $this
    ->drupalLogin($account);
  $this
    ->createLayoutForNodeType('alpha');
  $this
    ->createLayoutForNodeType('beta');
  $this
    ->enableLayoutBuilderForNodeType('alpha');
  $this
    ->enableLayoutBuilderForNodeType('beta');
  $this
    ->drupalGet('/node/add/alpha');
  $assert
    ->optionExists('Layout', 'alpha');
  $assert
    ->optionNotExists('Layout', 'beta');
  $this
    ->drupalGet('/node/add/beta');
  $assert
    ->optionNotExists('Layout', 'alpha');
  $assert
    ->optionExists('Layout', 'beta');
}