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

GraphQLCoreTestBase::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
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