You are here

public function ValidatorTest::testGetOrphanedResolversDetectsCanIgnoreTypes in GraphQL 8.4

@covers ::getOrphanedResolvers

File

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

Class

ValidatorTest
Tests that the GraphQL validator behaves correctly.

Namespace

Drupal\Tests\graphql\Kernel

Code

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

      union Actor = User

      type User {
        name: String!
      }
GQL;
  $this
    ->setUpSchema($schema);
  $this
    ->mockResolver('Actor', 'name', $this->builder
    ->fromValue('Never used'));
  $validator = new Validator($this->schemaPluginManager);
  $orphaned_resolvers = $validator
    ->getOrphanedResolvers($this->server, [
    'Actor',
  ]);
  self::assertEquals([], $orphaned_resolvers);
}