public function TestFrameworkTest::testErrorAssertion in GraphQL 8.3
Same name and namespace in other branches
- 8.4 tests/src/Kernel/Framework/TestFrameworkTest.php \Drupal\Tests\graphql\Kernel\Framework\TestFrameworkTest::testErrorAssertion()
Test result error assertions.
File
- tests/
src/ Kernel/ Framework/ TestFrameworkTest.php, line 63
Class
- TestFrameworkTest
- Test the test framework.
Namespace
Drupal\Tests\graphql\Kernel\FrameworkCode
public function testErrorAssertion() {
// Errors are not cached at all.
$metadata = new CacheableMetadata();
$metadata
->setCacheMaxAge(0);
$this
->assertErrors('{ root }', [], [
'Cannot query field "root" on type "Query".',
], $metadata);
$this
->assertErrors('{ root }', [], [
'/root.*Query/',
], $metadata);
}