You are here

public function ResolverBuilderTest::testFromParent in GraphQL 8.4

@covers ::fromParent

File

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

Class

ResolverBuilderTest
Tests that the resolver builder behaves correctly.

Namespace

Drupal\Tests\graphql\Kernel

Code

public function testFromParent() : void {
  $this
    ->mockResolver('Query', 'tree', $this->builder
    ->fromValue('Some string value'));
  $this
    ->mockResolver('Tree', 'name', $this->builder
    ->fromParent());
  $query = <<<GQL
      query {
        tree {
          name
        }
      }
GQL;
  $this
    ->assertResults($query, [], [
    'tree' => [
      'name' => 'Some string value',
    ],
  ]);
}