You are here

public function NodeContextTest::testNodeContext in GraphQL 8.3

Regression test for unhandled logic exceptions.

Leaking cache metadata.

File

modules/graphql_core/tests/src/Kernel/Context/NodeContextTest.php, line 20

Class

NodeContextTest
Test full stack retrieval of a node context.

Namespace

Drupal\Tests\graphql_core\Kernel\Context

Code

public function testNodeContext() {
  $nodeId = Node::create([
    'title' => 'Test',
    'type' => 'test',
  ])
    ->save();
  $query = <<<GQL
query (\$path: String!) {
  route(path: \$path) {
    ... on InternalUrl {
      nodeContext {
        entityLabel
      }
    }
  }
}
GQL;
  $this
    ->query($query, [
    'path' => '/node/' . $nodeId,
  ]);
}