Passed
Pull Request — 8.x-1.x (#40)
by
unknown
02:16
created

ViewsTestBase::setUp()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 39
Code Lines 29

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 1
Metric Value
cc 2
eloc 29
c 1
b 1
f 1
nc 2
nop 0
dl 0
loc 39
rs 9.456
1
<?php
2
3
namespace Drupal\Tests\graphql_views\Kernel;
4
5
use Drupal\taxonomy\Entity\Term;
0 ignored issues
show
Bug introduced by
The type Drupal\taxonomy\Entity\Term was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Drupal\taxonomy\Entity\Vocabulary;
0 ignored issues
show
Bug introduced by
The type Drupal\taxonomy\Entity\Vocabulary was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
0 ignored issues
show
Bug introduced by
The type Drupal\Tests\field\Traits\EntityReferenceTestTrait was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Drupal\Tests\graphql\Kernel\GraphQLTestBase;
0 ignored issues
show
Bug introduced by
The type Drupal\Tests\graphql\Kernel\GraphQLTestBase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
0 ignored issues
show
Bug introduced by
The type Drupal\Tests\node\Traits\ContentTypeCreationTrait was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Drupal\Tests\node\Traits\NodeCreationTrait;
0 ignored issues
show
Bug introduced by
The type Drupal\Tests\node\Traits\NodeCreationTrait was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
12
/**
13
 * Base class for test views support in GraphQL.
14
 *
15
 * @group graphql_views
16
 */
17
abstract class ViewsTestBase extends GraphQLTestBase {
18
  use NodeCreationTrait;
19
  use ContentTypeCreationTrait;
20
  use EntityReferenceTestTrait;
21
22
  /**
23
   * {@inheritdoc}
24
   */
25
  protected static $modules = [
26
    'filter',
27
    'text',
28
    'views',
29
    'taxonomy',
30
    'graphql_views',
31
    'graphql_views_test',
32
  ];
33
34
  /**
35
   * A List of letters.
36
   *
37
   * @var string[]
38
   */
39
  protected $letters = ['A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C'];
40
41
  /**
42
   * {@inheritdoc}
43
   */
44
  protected function setUp(): void {
45
    parent::setUp();
46
    $this->installEntitySchema('view');
47
    $this->installEntitySchema('taxonomy_term');
48
    $this->installConfig(['node', 'filter', 'views', 'graphql_views_test']);
49
    $this->createContentType(['type' => 'test']);
50
    $this->createEntityReferenceField('node', 'test', 'field_tags', 'Tags', 'taxonomy_term');
51
52
    Vocabulary::create([
53
      'name' => 'Tags',
54
      'vid' => 'tags',
55
    ])->save();
56
57
    $terms = [];
58
59
    $terms['A'] = Term::create([
60
      'name' => 'Term A',
61
      'vid' => 'tags',
62
    ]);
63
    $terms['A']->save();
64
65
    $terms['B'] = Term::create([
66
      'name' => 'Term B',
67
      'vid' => 'tags',
68
    ]);
69
    $terms['B']->save();
70
71
    $terms['C'] = Term::create([
72
      'name' => 'Term C',
73
      'vid' => 'tags',
74
    ]);
75
    $terms['C']->save();
76
77
    foreach ($this->letters as $letter) {
78
      $this->createNode([
79
        'title' => 'Node ' . $letter,
80
        'type' => 'test',
81
        'field_tags' => $terms[$letter],
82
      ])->save();
83
    }
84
85
  }
86
87
}
88