You are here

protected function CacheableMetadataCalculationTest::assertCacheableMetadataHasBeenCalculated in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Kernel/CacheableMetadataCalculationTest.php \Drupal\Tests\views\Kernel\CacheableMetadataCalculationTest::assertCacheableMetadataHasBeenCalculated()

Checks whether the view has calculated its cacheability metadata.

Parameters

bool $expected_result: TRUE if it is expected that the cacheability metadata has been calculated. FALSE otherwise.

1 call to CacheableMetadataCalculationTest::assertCacheableMetadataHasBeenCalculated()
CacheableMetadataCalculationTest::testCacheableMetadataCalculation in core/modules/views/tests/src/Kernel/CacheableMetadataCalculationTest.php
Tests that cacheability metadata is only calculated when needed.

File

core/modules/views/tests/src/Kernel/CacheableMetadataCalculationTest.php, line 99

Class

CacheableMetadataCalculationTest
Tests that cacheability metadata is only calculated when needed.

Namespace

Drupal\Tests\views\Kernel

Code

protected function assertCacheableMetadataHasBeenCalculated($expected_result) {
  $this->state
    ->resetCache();
  $this
    ->assertEquals($expected_result, $this->state
    ->get('views_test_cacheable_metadata_has_been_accessed'));
}