public function ValidatorTest::testGetOrphanedResolversDetectsUnfieldableObjectResolvers in GraphQL 8.4
@covers ::getOrphanedResolvers
File
- tests/
src/ Kernel/ ValidatorTest.php, line 90
Class
- ValidatorTest
- Tests that the GraphQL validator behaves correctly.
Namespace
Drupal\Tests\graphql\KernelCode
public function testGetOrphanedResolversDetectsUnfieldableObjectResolvers() : 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);
self::assertEquals([
'Actor' => [
'name',
],
], $orphaned_resolvers);
}