3 namespace Drupal\Tests\views\Functional\Update;
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
6 use Drupal\views\Entity\View;
9 * Tests the upgrade path for cache max age with table displays.
11 * @see views_post_update_table_display_cache_max_age()
16 class TableDisplayCacheMaxAgeTest extends UpdatePathTestBase {
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',
29 * Tests the upgrade path for cache max age with table displays.
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']);
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']);