Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / system / tests / src / Functional / Menu / LocalTasksTest.php
index 12a157d5879a2e0355f4f4c18964bd92eca67a0e..1a49336777ed8f82939303781a21b86d5404d2a2 100644 (file)
@@ -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']],
+    ]);
+  }
+
 }