You are here

public function TableDisplayCacheMaxAgeTest::testViewsPostUpdateTableDisplayMaxCacheAge in Drupal 8

Tests the upgrade path for cache max age with table displays.

File

core/modules/views/tests/src/Functional/Update/TableDisplayCacheMaxAgeTest.php, line 31

Class

TableDisplayCacheMaxAgeTest
Tests the upgrade path for cache max age with table displays.

Namespace

Drupal\Tests\views\Functional\Update

Code

public function testViewsPostUpdateTableDisplayMaxCacheAge() {
  $view = View::load('test_table_max_age');
  $data = $view
    ->toArray();
  $this
    ->assertSame(0, $data['display']['default']['cache_metadata']['max-age']);
  $this
    ->runUpdates();

  // Load and initialize our test view.
  $view = View::load('test_table_max_age');
  $data = $view
    ->toArray();

  // Check that the field is using the expected max age value.
  $this
    ->assertSame(-1, $data['display']['default']['cache_metadata']['max-age']);
}