You are here

public function ResolverRegistryTest::testGetFieldResolverWithInheritanceGivesPrecedenceToType in GraphQL 8.4

@covers ::getFieldResolverWithInheritance

File

tests/src/Kernel/ResolverRegistryTest.php, line 109

Class

ResolverRegistryTest
Tests that the resolver registry behaves correctly.

Namespace

Drupal\Tests\graphql\Kernel

Code

public function testGetFieldResolverWithInheritanceGivesPrecedenceToType() : void {
  $this
    ->mockResolver('Vehicle', 'model', $this->builder
    ->fromValue('Vehicle'));
  $expected_resolver = $this->builder
    ->fromValue('Cabrio');
  $this
    ->mockResolver('Cabrio', 'model', $expected_resolver);
  $returned_resolver = $this->registry
    ->getFieldResolverWithInheritance($this->schema
    ->getSchema($this->registry)
    ->getType('Cabrio'), 'model');
  self::assertEquals($expected_resolver, $returned_resolver);
}