You are here

private function QueryResultAssertionTrait::getRenderer in GraphQL 8.4

Get the Drupal renderer.

Uses either the renderer available in the test class or fetches the Drupal renderer service.

Return value

\Drupal\Core\Render\RendererInterface The renderer service for the test.

File

tests/src/Traits/QueryResultAssertionTrait.php, line 243

Class

QueryResultAssertionTrait
Trait for easier assertion on GraphQL query results.

Namespace

Drupal\Tests\graphql\Traits

Code

private function getRenderer() : RendererInterface {
  if (!isset($this->renderer)) {
    $this->renderer = \Drupal::service('renderer');
  }
  return $this->renderer;
}