Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / views / tests / src / Functional / Update / CacheabilityMetadataUpdateTest.php
1 <?php
2
3 namespace Drupal\Tests\views\Functional\Update;
4
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
6 use Drupal\views\Views;
7
8 /**
9  * Tests that views cacheability metadata post update hook runs properly.
10  *
11  * @see views_post_update_update_cacheability_metadata().
12  *
13  * @group Update
14  */
15 class CacheabilityMetadataUpdateTest extends UpdatePathTestBase {
16
17   /**
18    * {@inheritdoc}
19    */
20   protected function setDatabaseDumpFiles() {
21     $this->databaseDumpFiles = [__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz'];
22   }
23
24   /**
25    * Tests that views cacheability metadata updated properly.
26    */
27   public function testUpdateHookN() {
28     $this->runUpdates();
29     foreach (Views::getAllViews() as $view) {
30       $displays = $view->get('display');
31       foreach (array_keys($displays) as $display_id) {
32         $display = $view->getDisplay($display_id);
33         $this->assertFalse(isset($display['cache_metadata']['cacheable']));
34         $this->assertTrue(isset($display['cache_metadata']['contexts']));
35         $this->assertTrue(isset($display['cache_metadata']['max-age']));
36         $this->assertTrue(isset($display['cache_metadata']['tags']));
37       }
38     }
39   }
40
41 }