Completed
Pull Request — 8.x-3.x (#1012)
by
unknown
01:25
created

EntityRevisionsTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testNodeContext() 0 29 1
1
<?php
2
3
namespace Drupal\Tests\graphql_core\Kernel\Entity;
4
5
use Drupal\node\Entity\Node;
6
use Drupal\Tests\graphql_core\Kernel\GraphQLContentTestBase;
7
8
/**
9
 * Fetch node revisions.
10
 *
11
 * @group graphql_core
12
 */
13
class EntityRevisionsTest extends GraphQLContentTestBase {
14
15
  /**
16
   * Regression test for unhandled logic exceptions.
17
   *
18
   * Leaking cache metadata.
19
   */
20
  public function testNodeContext() {
21
    $node = Node::create([
22
      'title' => 'Test',
23
      'type' => 'test',
24
    ]);
25
26
    $nodeId = $node->save();
27
    $draft = $this->getNewDraft($node);
28
    $draft->save();
29
30
31
    $query = <<<GQL
32
query (\$path: String!) {
33
  route(path: \$path) {
34
    ... on EntityCanonicalUrl {
35
      entity {
36
        ... on EntityRevisionable {
37
          entityRevisions {
38
            count
39
          }
40
        }
41
      }
42
    }
43
  }
44
}
45
GQL;
46
47
    $this->query($query, ['path' => '/node/' . $nodeId]);
48
  }
49
50
}
51