TableDisplayCacheMaxAgeTest.php in Drupal 8
File
core/modules/views/tests/src/Functional/Update/TableDisplayCacheMaxAgeTest.php
View source
<?php
namespace Drupal\Tests\views\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Entity\View;
class TableDisplayCacheMaxAgeTest extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../fixtures/update/table-cache-max-age.php',
];
}
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();
$view = View::load('test_table_max_age');
$data = $view
->toArray();
$this
->assertSame(-1, $data['display']['default']['cache_metadata']['max-age']);
}
}