protected function QueryResultAssertionTrait::assertResults in GraphQL 8.3
Same name and namespace in other branches
- 8.4 tests/src/Traits/QueryResultAssertionTrait.php \Drupal\Tests\graphql\Traits\QueryResultAssertionTrait::assertResults()
Assert a result for a graphql query and variables.
Parameters
string $query: The query string.
array $variables: The query variables.
array $expected: The expected result.
\Drupal\Core\Cache\CacheableMetadata $metadata: The expected cache metadata object.
46 calls to QueryResultAssertionTrait::assertResults()
- BlockTest::testStaticBlocks in modules/
graphql_core/ tests/ src/ Kernel/ Blocks/ BlockTest.php - Test if two static blocks are in the content area.
- BreadcrumbsTest::testBreadcrumbs in modules/
graphql_core/ tests/ src/ Kernel/ Breadcrumbs/ BreadcrumbsTest.php - Test that the breadcrumb query returns breadcrumbs for given path.
- BufferedFieldTest::testBatchedFields in tests/
src/ Kernel/ Framework/ BufferedFieldTest.php - Test if the schema is created properly.
- ContextTest::testSimpleContext in modules/
graphql_core/ tests/ src/ Kernel/ Context/ ContextTest.php - Test if the schema is created properly.
- EntityBasicFieldsTest::testBasicFields in modules/
graphql_core/ tests/ src/ Kernel/ Entity/ EntityBasicFieldsTest.php - Test if the basic fields are available on the interface.
File
- tests/
src/ Traits/ QueryResultAssertionTrait.php, line 98
Class
- QueryResultAssertionTrait
- Trait for easier assertion on GraphQL query results.
Namespace
Drupal\Tests\graphql\TraitsCode
protected function assertResults($query, $variables, $expected, CacheableMetadata $metadata) {
$result = $this
->graphQlProcessor()
->processQuery($this
->getDefaultSchema(), OperationParams::create([
'query' => $query,
'variables' => $variables,
]));
$this
->assertResultErrors($result, []);
$this
->assertResultData($result, $expected);
$this
->assertResultMetadata($result, $metadata);
}