function LayoutSectionTest::testLayoutUrlNoSectionField

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/Functional/LayoutSectionTest.php \Drupal\Tests\layout_builder\Functional\LayoutSectionTest::testLayoutUrlNoSectionField()
  2. 8.9.x core/modules/layout_builder/tests/src/Functional/LayoutSectionTest.php \Drupal\Tests\layout_builder\Functional\LayoutSectionTest::testLayoutUrlNoSectionField()
  3. 11.x core/modules/layout_builder/tests/src/Functional/LayoutSectionTest.php \Drupal\Tests\layout_builder\Functional\LayoutSectionTest::testLayoutUrlNoSectionField()

Tests that no Layout link shows without a section field.

File

core/modules/layout_builder/tests/src/Functional/LayoutSectionTest.php, line 228

Class

LayoutSectionTest
Tests the rendering of a layout section field.

Namespace

Drupal\Tests\layout_builder\Functional

Code

public function testLayoutUrlNoSectionField() : void {
  $node = $this->createNode([
    'type' => 'bundle_without_section_field',
    'title' => 'The node title',
    'body' => [
      [
        'value' => 'The node body',
      ],
    ],
  ]);
  $node->save();
  $this->drupalGet($node->toUrl('canonical')
    ->toString() . '/layout');
  $this->assertSession()
    ->statusCodeEquals(403);
}

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