You are here

public function ValidatorTest::testGetMissingResolversIgnoresMissingFieldsOnInterfaces in GraphQL 8.4

@covers ::getMissingResolvers

Interfaces are ignored because the implementing types are used to check whether a resolver is present.

File

tests/src/Kernel/ValidatorTest.php, line 42

Class

ValidatorTest
Tests that the GraphQL validator behaves correctly.

Namespace

Drupal\Tests\graphql\Kernel

Code

public function testGetMissingResolversIgnoresMissingFieldsOnInterfaces() : void {
  $schema = <<<GQL
      type Query {
        me: Actor
      }

      interface Actor {
        name: String!
      }

      type User implements Actor {
        name: String!
      }
GQL;
  $this
    ->setUpSchema($schema);
  $this
    ->mockResolver('Query', 'me', $this->builder
    ->fromValue('Test User'));
  $this
    ->mockResolver('User', 'name', $this->builder
    ->fromParent());
  $validator = new Validator($this->schemaPluginManager);
  $missing_resolvers = $validator
    ->getMissingResolvers($this->server);
  self::assertEquals([], $missing_resolvers);
}