CacheabilityMetadataUpdateTest.php in Drupal 8
File
core/modules/views/tests/src/Functional/Update/CacheabilityMetadataUpdateTest.php
View source
<?php
namespace Drupal\Tests\views\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Views;
class CacheabilityMetadataUpdateTest extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
];
}
public function testUpdateHookN() {
$this
->runUpdates();
foreach (Views::getAllViews() as $view) {
$displays = $view
->get('display');
foreach (array_keys($displays) as $display_id) {
$display = $view
->getDisplay($display_id);
$this
->assertFalse(isset($display['cache_metadata']['cacheable']));
$this
->assertTrue(isset($display['cache_metadata']['contexts']));
$this
->assertTrue(isset($display['cache_metadata']['max-age']));
$this
->assertTrue(isset($display['cache_metadata']['tags']));
}
}
}
}