You are here

public function ValidatorTest::testGetOrphanedResolversDetectsNonExistentResolvers in GraphQL 8.4

@covers ::getOrphanedResolvers

File

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

Class

ValidatorTest
Tests that the GraphQL validator behaves correctly.

Namespace

Drupal\Tests\graphql\Kernel

Code

public function testGetOrphanedResolversDetectsNonExistentResolvers() : void {
  $schema = <<<GQL
      type Query {
        me: String!
      }

GQL;
  $this
    ->setUpSchema($schema);
  $this
    ->mockResolver('Query', 'me', $this->builder
    ->fromValue('Test User'));
  $this
    ->mockResolver('User', 'name', $this->builder
    ->fromValue('Orphaned Name'));
  $validator = new Validator($this->schemaPluginManager);
  $orphaned_resolvers = $validator
    ->getOrphanedResolvers($this->server);
  self::assertEquals([
    'User' => [
      'name',
    ],
  ], $orphaned_resolvers);
}