function LayoutBuilderLocalTaskTest::testLocalTaskMultipleContentTypesCacheability
Tests the cacheability of local tasks with multiple content types.
File
-
core/
modules/ layout_builder/ tests/ src/ Functional/ LayoutBuilderLocalTaskTest.php, line 71
Class
- LayoutBuilderLocalTaskTest
- Tests Layout Builder local tasks.
Namespace
Drupal\Tests\layout_builder\FunctionalCode
public function testLocalTaskMultipleContentTypesCacheability() : void {
// Test when there are two content types, one with a display having Layout
// Builder enabled with overrides, and another with display not having
// Layout Builder enabled.
$this->drupalCreateContentType([
'type' => 'bundle_no_lb_display',
]);
LayoutBuilderEntityViewDisplay::load('node.bundle_no_lb_display.default')->disableLayoutBuilder()
->save();
$node_without_lb = $this->drupalCreateNode([
'type' => 'bundle_no_lb_display',
]);
$this->drupalCreateContentType([
'type' => 'bundle_with_overrides',
]);
LayoutBuilderEntityViewDisplay::load('node.bundle_with_overrides.default')->enableLayoutBuilder()
->setOverridable()
->save();
$node_with_overrides = $this->drupalCreateNode([
'type' => 'bundle_with_overrides',
]);
$assert_session = $this->assertSession();
$this->drupalLogin($this->drupalCreateUser([
'configure any layout',
]));
$this->drupalGet('node/' . $node_without_lb->id());
$assert_session->responseHeaderEquals('X-Drupal-Cache-Max-Age', '-1 (Permanent)');
$assert_session->statusCodeEquals(200);
$this->drupalGet('node/' . $node_with_overrides->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.