You are here

public function GraphQLFileTestTrait::assertNoErrors in GraphQL 8.3

Assert that the result contains no errors.

Parameters

array $data: The query result.

1 call to GraphQLFileTestTrait::assertNoErrors()
GraphQLFileTestTrait::requestWithQueryFile in tests/src/Traits/GraphQLFileTestTrait.php
Run http subrequest with a specific query file.

File

tests/src/Traits/GraphQLFileTestTrait.php, line 43

Class

GraphQLFileTestTrait
Trait for running tests against GraphQL query files.

Namespace

Drupal\Tests\graphql\Traits

Code

public function assertNoErrors(array $data) {
  $errors = array_map(function ($error) {
    return $error['message'];
  }, array_key_exists('errors', $data) ? $data['errors'] : []);
  $this
    ->assertEquals([], $errors, 'Invalid GraphQL query. Errors: ' . implode("\n* ", $errors));
}