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

EntityRevisionsTest::testNodeContext()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 29
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 11
nc 1
nop 0
dl 0
loc 29
rs 8.8571
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
 * Fetch node revisions.
10
 */
11
class EntityRevisionsTest extends GraphQLContentTestBase {
12
13
  /**
14
   * Regression test for unhandled logic exceptions.
15
   *
16
   * Leaking cache metadata.
17
   */
18
  public function testNodeContext() {
19
    $node = Node::create([
20
      'title' => 'Test',
21
      'type' => 'test',
22
    ]);
23
24
    $nodeId = $node->save();
25
    $draft = $this->getNewDraft($node);
26
    $draft->save();
27
28
29
    $query = <<<GQL
30
query (\$path: String!) {
31
  route(path: \$path) {
32
    ... on EntityCanonicalUrl {
33
      entity {
34
        ... on EntityRevisionable {
35
          entityRevisions {
36
            count
37
          }
38
        }
39
      }
40
    }
41
  }
42
}
43
GQL;
44
45
    $this->query($query, ['path' => '/node/' . $nodeId]);
46
  }
47
48
}
49