X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fsrc%2FFunctional%2FMenu%2FLocalTasksTest.php;fp=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fsrc%2FFunctional%2FMenu%2FLocalTasksTest.php;h=1a49336777ed8f82939303781a21b86d5404d2a2;hp=12a157d5879a2e0355f4f4c18964bd92eca67a0e;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php b/web/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php index 12a157d58..1a4933677 100644 --- a/web/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php +++ b/web/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php @@ -18,7 +18,7 @@ class LocalTasksTest extends BrowserTestBase { * * @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. @@ -253,4 +253,29 @@ class LocalTasksTest extends BrowserTestBase { $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']], + ]); + } + }