Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Pull Request — 0.8 (#176)
by Evgenij
08:19
created

QueryMaxDepthTest::testComplexityUnderLimitation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 8

Duplication

Lines 16
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 16
loc 16
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the OverblogGraphQLBundle package.
5
 *
6
 * (c) Overblog <http://github.com/overblog/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Overblog\GraphQLBundle\Tests\Functional\Security;
13
14
use Overblog\GraphQLBundle\Tests\Functional\TestCase;
15
16 View Code Duplication
class QueryMaxDepthTest extends TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
    private $userFriendsWithoutViolationQuery = <<<'EOF'
19
query {
20
  user {
21
    friends(first:1) {
22
      edges {
23
        node {
24
          name
25
        }
26
      }
27
    }
28
  }
29
}
30
EOF;
31
32
    private $userFriendsWithViolationQuery = <<<'EOF'
33
query {
34
  user {
35
    friends(first: 1) {
36
      edges {
37
        node {
38
          name
39
          friends {
40
            edges {
41
              node {
42
                name
43
              }
44
            }
45
          }
46
        }
47
      }
48
    }
49
  }
50
}
51
EOF;
52
53
    public function testMaxDepthReachLimitation()
54
    {
55
        $expected = [
56
            'errors' => [
57
                [
58
                    'message' => 'Max query depth should be 3 but got 6.',
59
                ],
60
            ],
61
        ];
62
63
        $this->assertResponse($this->userFriendsWithViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepth');
64
    }
65
66
    public function testMaxDepthReachLimitationEnv()
67
    {
68
        $expected = [
69
            'errors' => [
70
                [
71
                    'message' => 'Max query depth should be 3 but got 6.',
72
                ],
73
            ],
74
        ];
75
76
        $this->assertResponse($this->userFriendsWithViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepthEnv');
77
    }
78
79
    public function testComplexityUnderLimitation()
80
    {
81
        $expected = [
82
            'data' => [
83
                'user' => [
84
                    'friends' => [
85
                        'edges' => [
86
                            ['node' => ['name' => 'Nick']],
87
                        ],
88
                    ],
89
                ],
90
            ],
91
        ];
92
93
        $this->assertResponse($this->userFriendsWithoutViolationQuery, $expected, self::ANONYMOUS_USER, 'queryMaxDepth');
94
    }
95
}
96