You are here

protected function MockGraphQLPluginTrait::mockUnionFactory in GraphQL 8.3

File

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

Class

MockGraphQLPluginTrait
Trait for mocking GraphQL type system plugins.

Namespace

Drupal\Tests\graphql\Traits

Code

protected function mockUnionFactory($definition, $builder) {
  $union = $this
    ->getMockForAbstractClass(UnionTypePluginBase::class, [
    [],
    $definition['id'],
    $definition,
  ]);
  if (is_callable($union)) {
    $builder($union);
  }
  return $union;
}