function LayoutBuilderLocalTaskTest::testLocalTaskLayoutBuilderInstalledCacheability

Same name in other branches
  1. 11.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderLocalTaskTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderLocalTaskTest::testLocalTaskLayoutBuilderInstalledCacheability()

Tests the cacheability of local tasks with Layout Builder module installed.

File

core/modules/layout_builder/tests/src/Functional/LayoutBuilderLocalTaskTest.php, line 43

Class

LayoutBuilderLocalTaskTest
Tests Layout Builder local tasks.

Namespace

Drupal\Tests\layout_builder\Functional

Code

public function testLocalTaskLayoutBuilderInstalledCacheability() : void {
    // Create only one bundle and do not enable layout builder on its display.
    $this->drupalCreateContentType([
        'type' => 'bundle_no_lb_display',
    ]);
    LayoutBuilderEntityViewDisplay::load('node.bundle_no_lb_display.default')->disableLayoutBuilder()
        ->save();
    $node = $this->drupalCreateNode([
        'type' => 'bundle_no_lb_display',
    ]);
    $assert_session = $this->assertSession();
    $this->drupalLogin($this->drupalCreateUser([
        'configure any layout',
    ]));
    $this->drupalGet('node/' . $node->id());
    $assert_session->responseHeaderEquals('X-Drupal-Cache-Max-Age', '-1 (Permanent)');
    $assert_session->statusCodeEquals(200);
}

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