You are here

public function CacheabilityMetadataUpdateTest::testUpdateHookN in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Update/CacheabilityMetadataUpdateTest.php \Drupal\views\Tests\Update\CacheabilityMetadataUpdateTest::testUpdateHookN()

Tests that views cacheability metadata updated properly.

File

core/modules/views/src/Tests/Update/CacheabilityMetadataUpdateTest.php, line 32
Contains \Drupal\views\Tests\Update\CacheabilityMetadataUpdateTest.

Class

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

Namespace

Drupal\views\Tests\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']));
    }
  }
}