You are here

protected function MockGraphQLPluginTrait::mockSchemaFactory in GraphQL 8.3

File

tests/src/Traits/MockGraphQLPluginTrait.php, line 289

Class

MockGraphQLPluginTrait
Trait for mocking GraphQL type system plugins.

Namespace

Drupal\Tests\graphql\Traits

Code

protected function mockSchemaFactory($definition, $builder) {
  $schema = $this
    ->getMockForAbstractClass(SchemaPluginBase::class, [
    [],
    $definition['id'],
    $definition,
    $this->container
      ->get('plugin.manager.graphql.field'),
    $this->container
      ->get('plugin.manager.graphql.mutation'),
    $this->container
      ->get('plugin.manager.graphql.subscription'),
    $this->container
      ->get('graphql.type_manager_aggregator'),
    $this->container
      ->get('graphql.query_provider'),
    $this->container
      ->get('current_user'),
    $this->container
      ->get('logger.channel.graphql'),
    $this->container
      ->get('language_manager'),
    $this->container
      ->getParameter('graphql.config'),
  ]);
  if (is_callable($builder)) {
    $builder($schema);
  }
  return $schema;
}