public function ResolverBuilderTest::testCompose in GraphQL 8.4
@covers ::compose
File
- tests/
src/ Kernel/ ResolverBuilderTest.php, line 160
Class
- ResolverBuilderTest
- Tests that the resolver builder behaves correctly.
Namespace
Drupal\Tests\graphql\KernelCode
public function testCompose() : void {
$this
->mockResolver('Query', 'tree', $this->builder
->fromValue([
'name' => 'some tree',
'id' => 5,
]));
$this
->mockResolver('Tree', 'name', $this->builder
->compose($this->builder
->fromValue('Some tree name'), $this->builder
->produce('uppercase')
->map('string', $this->builder
->fromParent())));
$query = <<<GQL
query {
tree {
name
}
}
GQL;
$this
->assertResults($query, [], [
'tree' => [
'name' => 'SOME TREE NAME',
],
]);
}