You are here

public function ResolverBuilderTest::testFromArgument in GraphQL 8.4

@covers ::fromArgument

File

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

Class

ResolverBuilderTest
Tests that the resolver builder behaves correctly.

Namespace

Drupal\Tests\graphql\Kernel

Code

public function testFromArgument() : void {
  $this
    ->mockResolver('Query', 'tree', $this->builder
    ->fromValue([
    'name' => 'some tree',
    'id' => 5,
  ]));
  $this
    ->mockResolver('Tree', 'id', $this->builder
    ->fromArgument('someArg'));
  $query = <<<GQL
      query {
        tree(id: 5) {
          id(someArg: 234)
        }
      }
GQL;
  $this
    ->assertResults($query, [], [
    'tree' => [
      'id' => 234,
    ],
  ]);
}