protected function MockGraphQLPluginTrait::mockInterface in GraphQL 8.3
Mock a GraphQL interface.
Parameters
string $id: The interface id.
array $definition: The plugin definition. Will be merged with the interface defaults.
Return value
\PHPUnit\Framework\MockObject\MockObject The interface mock object.
1 call to MockGraphQLPluginTrait::mockInterface()
- TestFrameworkTest::testInterfaceMock in tests/
src/ Kernel/ Framework/ TestFrameworkTest.php - Test interface mocking.
File
- tests/
src/ Traits/ MockGraphQLPluginTrait.php, line 519
Class
- MockGraphQLPluginTrait
- Trait for mocking GraphQL type system plugins.
Namespace
Drupal\Tests\graphql\TraitsCode
protected function mockInterface($id, array $definition, $builder = NULL) {
$definition = $this
->getTypeSystemPluginDefinition(GraphQLInterface::class, $definition + [
'id' => $id,
'class' => InterfacePluginBase::class,
'mock_factory' => 'mockInterfaceFactory',
]);
$this->graphQLPlugins[InputTypePluginBase::class][$id] = [
'definition' => $definition,
'builder' => $builder,
];
}