function RendererTest::testHasRenderContext
@covers ::hasRenderContext
File
-
core/
tests/ Drupal/ Tests/ Core/ Render/ RendererTest.php, line 1081
Class
- RendererTest
- @coversDefaultClass \Drupal\Core\Render\Renderer @group Render
Namespace
Drupal\Tests\Core\RenderCode
public function testHasRenderContext() : void {
// Tests with no render context.
$this->assertFalse($this->renderer
->hasRenderContext());
// Tests in a render context.
$this->renderer
->executeInRenderContext(new RenderContext(), function () {
$this->assertTrue($this->renderer
->hasRenderContext());
});
// Test that the method works with no current request.
$this->requestStack
->pop();
$this->assertFalse($this->renderer
->hasRenderContext());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.