Completed
Pull Request — 8.x-3.x (#501)
by Philipp
04:28
created

RouteEntityTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B testRouteEntity() 0 36 1
1
<?php
2
3
namespace Drupal\Tests\graphql_core\Kernel\Routing;
4
5
use Drupal\Tests\graphql_core\Kernel\GraphQLContentTestBase;
6
7
/**
8
 * Test file attachments.
9
 *
10
 * @group graphql_image
11
 */
12
class RouteEntityTest extends GraphQLContentTestBase {
13
14
  public function testRouteEntity() {
15
    $node = $this->createNode([
16
      'title' => 'Node A',
17
      'type' => 'test',
18
    ]);
19
20
    $node->save();
21
22
    $query = $this->getQueryFromFile('route_entity.gql');
23
    $vars = ['path' => '/node/' . $node->id()];
24
25
    // TODO: Check cache metadata.
26
    $metadata = $this->defaultCacheMetaData();
27
    $metadata->addCacheTags([
28
      'node:1',
29
    ]);
30
31
    $this->assertResults($query, $vars, [
32
      'route' => [
33
        'node' => [
34
          'title' => 'Node A',
35
        ],
36
      ],
37
    ], $metadata);
38
39
    $node->setTitle('Node B');
40
    $node->save();
41
42
    $this->assertResults($query, $vars, [
43
      'route' => [
44
        'node' => [
45
          'title' => 'Node B',
46
        ],
47
      ],
48
    ], $metadata);
49
  }
50
51
}
52