You are here

trait EnableCliCacheTrait in GraphQL 8.3

Trait to automatically enable CLI caching in GraphQL tests.

Hierarchy

1 file declares its use of EnableCliCacheTrait
GraphQLTestBase.php in tests/src/Kernel/GraphQLTestBase.php

File

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

Namespace

Drupal\Tests\graphql\Traits
View source
trait EnableCliCacheTrait {

  /**
   * Enable caching in CLI environments.
   */
  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());
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EnableCliCacheTrait::enableCliCache protected function Enable caching in CLI environments.