You are here

protected function MockingTrait::mockSchemaPluginManager in GraphQL 8.4

Mock schema plugin manager.

Parameters

string $id:

1 call to MockingTrait::mockSchemaPluginManager()
MockingTrait::setUpSchema in tests/src/Traits/MockingTrait.php
Setup server with schema.

File

tests/src/Traits/MockingTrait.php, line 165

Class

MockingTrait
Contains helpers for setting up mock servers and schemas for testing.

Namespace

Drupal\Tests\graphql\Traits

Code

protected function mockSchemaPluginManager($id) : void {
  $this->schemaPluginManager = $this
    ->getMockBuilder(SchemaPluginManager::class)
    ->disableOriginalConstructor()
    ->getMock();
  $this->schemaPluginManager
    ->expects($this
    ->any())
    ->method('getDefinitions')
    ->will($this
    ->returnValue([
    $id => [
      'id' => $id,
      'name' => 'Test schema',
      'provider' => 'graphql',
      'class' => '\\Drupal\\graphql\\Plugin\\GraphQL\\Schema\\SdlSchemaPluginBase',
    ],
  ]));
}