You are here

protected function CacheableMetadataCalculationTest::assertCacheableMetadataHasBeenCalculated in Drupal 10

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

Checks whether the view has calculated its cacheability metadata.

@internal

Parameters

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

File

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

Class

CacheableMetadataCalculationTest
Tests that cacheability metadata is only calculated when needed.

Namespace

Drupal\Tests\views\Kernel

Code

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