You are here

public function CacheabilityMetadataUpdateTest::testUpdateHookN in Drupal 8

Tests that views cacheability metadata updated properly.

File

core/modules/views/tests/src/Functional/Update/CacheabilityMetadataUpdateTest.php, line 28

Class

CacheabilityMetadataUpdateTest
Tests that views cacheability metadata post update hook runs properly.

Namespace

Drupal\Tests\views\Functional\Update

Code

public function testUpdateHookN() {
  $this
    ->runUpdates();
  foreach (Views::getAllViews() as $view) {
    $displays = $view
      ->get('display');
    foreach (array_keys($displays) as $display_id) {
      $display = $view
        ->getDisplay($display_id);
      $this
        ->assertFalse(isset($display['cache_metadata']['cacheable']));
      $this
        ->assertTrue(isset($display['cache_metadata']['contexts']));
      $this
        ->assertTrue(isset($display['cache_metadata']['max-age']));
      $this
        ->assertTrue(isset($display['cache_metadata']['tags']));
    }
  }
}