assertCacheableMetadataHasBeenCalculated example


  public function testCacheableMetadataCalculation() {
    // Enabling a module that contains a view should not cause the cacheability     // metadata to be recalculated.     $this->enableModules([self::TEST_MODULE]);
    $this->installConfig([self::TEST_MODULE]);
    $this->assertCacheableMetadataHasBeenCalculated(FALSE);

    // When a view is saved normally we have to recalculate the cacheability     // metadata, since it is possible changes have been made to the view that     // affect cacheability.     $view = $this->entityTypeManager->getStorage('view')->load(self::TEST_VIEW_ID);
    $view->save();
    $this->assertCacheableMetadataHasBeenCalculated(TRUE);
    $this->resetState();

    // When a view is being saved due to config being synchronized, the     // cacheability metadata doesn't change so it should not be recalculated.
Home | Imprint | This part of the site doesn't use cookies.