Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / views / tests / src / Functional / Plugin / StyleTableTest.php
index 3bbe6bf97c3c965c87dc434f9bd87ad39ff8ca9d..5f1e642aa1d2e16a13a724c5c06164857b7f5370 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\views\Functional\Plugin;
 
+use Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber;
 use Drupal\Tests\views\Functional\ViewTestBase;
 use Drupal\views\Entity\View;
 
@@ -229,4 +230,18 @@ class StyleTableTest extends ViewTestBase {
     }
   }
 
+  /**
+   * Tests the cacheability of the table display.
+   */
+  public function testTableCacheability() {
+    \Drupal::service('module_installer')->uninstall(['page_cache']);
+
+    $url = 'test-table';
+    $this->drupalGet($url);
+    $this->assertSession()->statusCodeEquals(200);
+    $this->assertEquals('MISS', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER));
+    $this->drupalGet($url);
+    $this->assertEquals('HIT', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER));
+  }
+
 }