function LocalTasksTest::testLocalTaskBlockCache
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php \Drupal\Tests\system\Functional\Menu\LocalTasksTest::testLocalTaskBlockCache()
- 8.9.x core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php \Drupal\Tests\system\Functional\Menu\LocalTasksTest::testLocalTaskBlockCache()
- 10 core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php \Drupal\Tests\system\Functional\Menu\LocalTasksTest::testLocalTaskBlockCache()
Tests that local tasks blocks cache is invalidated correctly.
File
-
core/
modules/ system/ tests/ src/ Functional/ Menu/ LocalTasksTest.php, line 263
Class
- LocalTasksTest
- Tests local tasks derived from router and added/altered via hooks.
Namespace
Drupal\Tests\system\Functional\MenuCode
public function testLocalTaskBlockCache() : void {
$this->drupalLogin($this->drupalCreateUser([
'administer content types',
'administer permissions',
'administer account settings',
]));
$this->drupalCreateContentType([
'type' => 'page',
]);
// Only the Edit task. The block avoids showing a single tab.
$this->drupalGet('/admin/config/people/accounts');
$this->assertSession()
->statusCodeEquals(200);
$this->assertNoLocalTasks();
// Only the Edit and Manage permission tabs.
$this->drupalGet('/admin/structure/types/manage/page');
$this->assertLocalTasks([
[
'entity.node_type.edit_form',
[
'node_type' => 'page',
],
],
[
'entity.node_type.entity_permissions_form',
[
'node_type' => 'page',
],
],
]);
// Field UI adds the usual Manage fields etc tabs.
\Drupal::service('module_installer')->install([
'field_ui',
]);
$this->drupalLogin($this->drupalCreateUser([
'administer content types',
'administer permissions',
'administer account settings',
'administer display modes',
'administer node display',
'administer node fields',
'administer node form display',
]));
$this->drupalGet('/admin/structure/types/manage/page');
$this->assertLocalTasks([
[
'entity.node_type.edit_form',
[
'node_type' => 'page',
],
],
[
'entity.node.field_ui_fields',
[
'node_type' => 'page',
],
],
[
'entity.entity_form_display.node.default',
[
'node_type' => 'page',
],
],
[
'entity.entity_view_display.node.default',
[
'node_type' => 'page',
],
],
[
'entity.node_type.entity_permissions_form',
[
'node_type' => 'page',
],
],
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.