You are here

protected function EnableCliCacheTrait::enableCliCache in GraphQL 8.3

Enable caching in CLI environments.

File

tests/src/Traits/EnableCliCacheTrait.php, line 16

Class

EnableCliCacheTrait
Trait to automatically enable CLI caching in GraphQL tests.

Namespace

Drupal\Tests\graphql\Traits

Code

protected function enableCliCache() {

  // Disable the cli deny policy because we actually want caching on cli
  // when kernel testing it.
  $cliPolicy = $this
    ->prophesize(RequestPolicyInterface::class);
  $cliPolicy
    ->check(Argument::cetera())
    ->willReturn(NULL);
  $this->container
    ->set('graphql.request_policy.deny_command_line', $cliPolicy
    ->reveal());
}