function RendererTestBase::setUpMockCacheContextsManager

Reinitializes the cache contexts manager as a mock object.

File

core/tests/Drupal/Tests/Core/Render/RendererTestBase.php, line 240

Class

RendererTestBase
Base class for the actual unit tests testing \Drupal\Core\Render\Renderer.

Namespace

Drupal\Tests\Core\Render

Code

protected function setUpMockCacheContextsManager() : void {
  $this->cacheContextsManager = $this->createMock(CacheContextsManager::class);
  $reflection = new \ReflectionProperty($this->renderCache, 'cacheContextsManager');
  $reflection->setValue($this->renderCache, $this->cacheContextsManager);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.