Updated Drupal to 8.6. This goes with the following updates because it's possible...
[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  * @group legacy
15  */
16 class CacheabilityMetadataUpdateTest extends UpdatePathTestBase {
17
18   /**
19    * {@inheritdoc}
20    */
21   protected function setDatabaseDumpFiles() {
22     $this->databaseDumpFiles = [__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz'];
23   }
24
25   /**
26    * Tests that views cacheability metadata updated properly.
27    */
28   public function testUpdateHookN() {
29     $this->runUpdates();
30     foreach (Views::getAllViews() as $view) {
31       $displays = $view->get('display');
32       foreach (array_keys($displays) as $display_id) {
33         $display = $view->getDisplay($display_id);
34         $this->assertFalse(isset($display['cache_metadata']['cacheable']));
35         $this->assertTrue(isset($display['cache_metadata']['contexts']));
36         $this->assertTrue(isset($display['cache_metadata']['max-age']));
37         $this->assertTrue(isset($display['cache_metadata']['tags']));
38       }
39     }
40   }
41
42 }