Unverified Commit 3fe7057f authored by alexpott's avatar alexpott
Browse files

Issue #2861210 by tetranz, borisson_, zuuperman, axel.rutz, alexpott: Local...

Issue #2861210 by tetranz, borisson_, zuuperman, axel.rutz, alexpott: Local tasks are not shown after enabling module
parent 37e09ab4
...@@ -85,6 +85,7 @@ public function defaultConfiguration() { ...@@ -85,6 +85,7 @@ public function defaultConfiguration() {
public function build() { public function build() {
$config = $this->configuration; $config = $this->configuration;
$cacheability = new CacheableMetadata(); $cacheability = new CacheableMetadata();
$cacheability->addCacheableDependency($this->localTaskManager);
$tabs = [ $tabs = [
'#theme' => 'menu_local_tasks', '#theme' => 'menu_local_tasks',
]; ];
......
...@@ -86,6 +86,7 @@ public function testPageCacheTags() { ...@@ -86,6 +86,7 @@ public function testPageCacheTags() {
'http_response', 'http_response',
'rendered', 'rendered',
'block_view', 'block_view',
'local_task',
'config:block_list', 'config:block_list',
'config:block.block.bartik_branding', 'config:block.block.bartik_branding',
'config:block.block.bartik_breadcrumbs', 'config:block.block.bartik_breadcrumbs',
...@@ -127,6 +128,7 @@ public function testPageCacheTags() { ...@@ -127,6 +128,7 @@ public function testPageCacheTags() {
'http_response', 'http_response',
'rendered', 'rendered',
'block_view', 'block_view',
'local_task',
'config:block_list', 'config:block_list',
'config:block.block.bartik_branding', 'config:block.block.bartik_branding',
'config:block.block.bartik_breadcrumbs', 'config:block.block.bartik_breadcrumbs',
......
...@@ -18,7 +18,7 @@ class LocalTasksTest extends BrowserTestBase { ...@@ -18,7 +18,7 @@ class LocalTasksTest extends BrowserTestBase {
* *
* @var string[] * @var string[]
*/ */
public static $modules = ['block', 'menu_test', 'entity_test']; public static $modules = ['block', 'menu_test', 'entity_test', 'node'];
/** /**
* The local tasks block under testing. * The local tasks block under testing.
...@@ -253,4 +253,29 @@ public function testLocalTaskBlock() { ...@@ -253,4 +253,29 @@ public function testLocalTaskBlock() {
$this->assertLocalTasks($sub_tasks, 1); $this->assertLocalTasks($sub_tasks, 1);
} }
/**
* Test that local tasks blocks cache is invalidated correctly.
*/
public function testLocalTaskBlockCache() {
$this->drupalLogin($this->rootUser);
$this->drupalCreateContentType(['type' => 'page']);
$this->drupalGet('/admin/structure/types/manage/page');
// Only the Edit task. The block avoids showing a single tab.
$this->assertNoLocalTasks();
// Field UI adds the usual Manage fields etc tabs.
\Drupal::service('module_installer')->install(['field_ui']);
$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']],
]);
}
} }
...@@ -93,6 +93,7 @@ public function testTrackerAll() { ...@@ -93,6 +93,7 @@ public function testTrackerAll() {
$expected_tags = Cache::mergeTags($expected_tags, $role_tags); $expected_tags = Cache::mergeTags($expected_tags, $role_tags);
$block_tags = [ $block_tags = [
'block_view', 'block_view',
'local_task',
'config:block.block.page_actions_block', 'config:block.block.page_actions_block',
'config:block.block.page_tabs_block', 'config:block.block.page_tabs_block',
'config:block_list', 'config:block_list',
...@@ -179,6 +180,7 @@ public function testTrackerUser() { ...@@ -179,6 +180,7 @@ public function testTrackerUser() {
$expected_tags = Cache::mergeTags($expected_tags, $role_tags); $expected_tags = Cache::mergeTags($expected_tags, $role_tags);
$block_tags = [ $block_tags = [
'block_view', 'block_view',
'local_task',
'config:block.block.page_actions_block', 'config:block.block.page_actions_block',
'config:block.block.page_tabs_block', 'config:block.block.page_tabs_block',
'config:block_list', 'config:block_list',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment