You are here

public function ResolverRegistryTest::testGetAllFieldResolvers in GraphQL 8.4

@covers ::getAllFieldResolvers

File

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

Class

ResolverRegistryTest
Tests that the resolver registry behaves correctly.

Namespace

Drupal\Tests\graphql\Kernel

Code

public function testGetAllFieldResolvers() : void {
  $transportation_resolver = $this->builder
    ->fromValue('Ford Model T');
  $this
    ->mockResolver('Query', 'transportation', $transportation_resolver);
  $car_resolver = $this->builder
    ->fromParent();
  $this
    ->mockResolver('Car', 'model', $car_resolver);
  $cabrio_resolver = $this->builder
    ->fromValue('Cabrio');
  $this
    ->mockResolver('Cabrio', 'model', $cabrio_resolver);
  self::assertEquals([
    'Query' => [
      'transportation' => $transportation_resolver,
    ],
    'Car' => [
      'model' => $car_resolver,
    ],
    'Cabrio' => [
      'model' => $cabrio_resolver,
    ],
  ], $this->registry
    ->getAllFieldResolvers());
}