private function QueryResultAssertionTrait::assertResultData in GraphQL 8.4
Same name and namespace in other branches
- 8.3 tests/src/Traits/QueryResultAssertionTrait.php \Drupal\Tests\graphql\Traits\QueryResultAssertionTrait::assertResultData()
Assert a certain result data set on a query result.
@internal
Parameters
\Drupal\graphql\GraphQL\Execution\ExecutionResult $result: The query result object.
mixed $expected: The expected result data set.
1 call to QueryResultAssertionTrait::assertResultData()
- QueryResultAssertionTrait::assertResults in tests/
src/ Traits/ QueryResultAssertionTrait.php - Assert a result for a graphql query and variables.
File
- tests/
src/ Traits/ QueryResultAssertionTrait.php, line 151
Class
- QueryResultAssertionTrait
- Trait for easier assertion on GraphQL query results.
Namespace
Drupal\Tests\graphql\TraitsCode
private function assertResultData(ExecutionResult $result, $expected) : void {
$data = $result
->toArray();
$this
->assertArrayHasKey('data', $data, 'No result data.');
$this
->assertEquals($expected, $data['data'], 'Unexpected query result.');
}