You are here

protected function MockGraphQLPluginTrait::mockEnum in GraphQL 8.3

Mock a GraphQL enum.

Parameters

string $id: The enum id.

array $definition: The plugin definition. Will be merged with the enum defaults.

mixed $values: The array enum values. Can also be a value callback.

1 call to MockGraphQLPluginTrait::mockEnum()
TestFrameworkTest::testMutationMock in tests/src/Kernel/Framework/TestFrameworkTest.php
Test mutation mocking.

File

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

Class

MockGraphQLPluginTrait
Trait for mocking GraphQL type system plugins.

Namespace

Drupal\Tests\graphql\Traits

Code

protected function mockEnum($id, array $definition, $values = [], $builder = NULL) {
  $definition = $this
    ->getTypeSystemPluginDefinition(GraphQLEnum::class, $definition + [
    'id' => $id,
    'class' => EnumPluginBase::class,
    'mock_factory' => 'mockEnumFactory',
  ]);
  $this->graphQLPlugins[EnumPluginBase::class][$id] = [
    'definition' => $definition,
    'values' => $values,
    'builder' => $builder,
  ];
}