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

GraphQLCoreTestBase   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A defaultCacheTags() 0 11 1
1
<?php
2
3
namespace Drupal\Tests\graphql_core\Kernel;
4
5
use Drupal\Tests\graphql\Kernel\GraphQLTestBase;
6
7
/**
8
 * Test base for drupal core graphql functionality.
9
 */
10
class GraphQLCoreTestBase extends GraphQLTestBase {
11
12
  /**
13
   * {@inheritdoc}
14
   */
15
  public static $modules = [
16
    'graphql_core',
17
    'user',
18
  ];
19
20
  /**
21
   * {@inheritdoc}
22
   */
23
  protected function setUp() {
24
    parent::setUp();
25
    // User entity schema is required for the currentUserContext field.
26
    $this->installEntitySchema('user');
27
  }
28
29
  /**
30
   * {@inheritdoc}
31
   */
32
  protected function defaultCacheTags() {
33
    // graphql_core derives fields and types from entity information, so the
34
    // cache tags are applied to the schema and end up in every result.
35
    //
36
    // https://github.com/drupal-graphql/graphql/issues/500
37
    return array_merge(parent::defaultCacheTags(), [
38
      'entity_bundles',
39
      'entity_field_info',
40
      'entity_types',
41
    ]);
42
  }
43
44
}
45