Completed
Push — 8.x-3.x ( 13bbe7...e0918c )
by Philipp
02:13
created

NodeContextTest::testNodeContext()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 20
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Drupal\Tests\graphql_core\Kernel\Context;
4
5
use Drupal\node\Entity\Node;
6
use Drupal\Tests\graphql_core\Kernel\GraphQLContentTestBase;
7
8
/**
9
 * Test full stack retrieval of a node context.
10
 */
11
class NodeContextTest extends GraphQLContentTestBase {
12
13
  /**
14
   * Regression test for unhandled logic exceptions.
15
   *
16
   * Leaking cache metadata.
17
   */
18
  public function testNodeContext() {
19
    $nodeId = Node::create([
20
      'title' => 'Test',
21
      'type' => 'test',
22
    ])->save();
23
24
    $query = <<<GQL
25
query (\$path: String!) {
26
  route(path: \$path) {
27
    ... on InternalUrl {
28
      nodeContext {
29
        entityLabel
30
      }
31
    }
32
  }
33
}
34
GQL;
35
36
    $this->query($query, ['path' => '/node/' . $nodeId]);
37
  }
38
39
}
40