You are here

protected function MockGraphQLPluginTrait::mockSchema in GraphQL 8.3

Mock a schema instance.

Parameters

string $id: The schema id.

callable|null $builder: A builder callback to modify the mock instance.

1 call to MockGraphQLPluginTrait::mockSchema()
GraphQLTestBase::setUp in tests/src/Kernel/GraphQLTestBase.php

File

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

Class

MockGraphQLPluginTrait
Trait for mocking GraphQL type system plugins.

Namespace

Drupal\Tests\graphql\Traits

Code

protected function mockSchema($id, $builder = NULL) {
  $this->graphQLPlugins[SchemaPluginBase::class][$id] = [
    'definition' => $this
      ->getSchemaDefinitions()[$id] + [
      'mock_factory' => 'mockSchemaFactory',
    ],
    'builder' => $builder,
  ];
}