Pull merge.
[yaffs-website] / web / core / modules / views / tests / src / Functional / Update / TableDisplayCacheMaxAgeTest.php
1 <?php
2
3 namespace Drupal\Tests\views\Functional\Update;
4
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
6 use Drupal\views\Entity\View;
7
8 /**
9  * Tests the upgrade path for cache max age with table displays.
10  *
11  * @see views_post_update_table_display_cache_max_age()
12  *
13  * @group Update
14  * @group legacy
15  */
16 class TableDisplayCacheMaxAgeTest extends UpdatePathTestBase {
17
18   /**
19    * {@inheritdoc}
20    */
21   protected function setDatabaseDumpFiles() {
22     $this->databaseDumpFiles = [
23       __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
24       __DIR__ . '/../../../fixtures/update/table-cache-max-age.php',
25     ];
26   }
27
28   /**
29    * Tests the upgrade path for cache max age with table displays.
30    */
31   public function testViewsPostUpdateTableDisplayMaxCacheAge() {
32     $view = View::load('test_table_max_age');
33     $data = $view->toArray();
34     $this->assertSame(0, $data['display']['default']['cache_metadata']['max-age']);
35
36     $this->runUpdates();
37
38     // Load and initialize our test view.
39     $view = View::load('test_table_max_age');
40     $data = $view->toArray();
41     // Check that the field is using the expected max age value.
42     $this->assertSame(-1, $data['display']['default']['cache_metadata']['max-age']);
43   }
44
45 }