You are here

public function ResolverBuilderTest::testComposeNullValue in GraphQL 8.4

@covers ::compose

File

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

Class

ResolverBuilderTest
Tests that the resolver builder behaves correctly.

Namespace

Drupal\Tests\graphql\Kernel

Code

public function testComposeNullValue() : void {
  $this
    ->mockResolver('Query', 'tree', $this->builder
    ->fromValue([
    'name' => 'some tree',
    'id' => 5,
  ]));
  $this
    ->mockResolver('Tree', 'name', $this->builder
    ->compose($this->builder
    ->fromValue(NULL), $this->builder
    ->produce('uppercase')
    ->map('string', $this->builder
    ->fromParent())));
  $query = <<<GQL
      query {
        tree {
          name
        }
      }
GQL;
  $this
    ->assertResults($query, [], [
    'tree' => [
      'name' => NULL,
    ],
  ]);
}