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

testComplexityReachLimitationEnv()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 5

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 12
loc 12
rs 9.4285
cc 1
eloc 5
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 QueryComplexityTest 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 $userFriendsWithoutLimitQuery = <<<'EOF'
19
query {
20
  user {
21
    friends {
22
      edges {
23
        node {
24
          name
25
        }
26
      }
27
    }
28
  }
29
}
30
EOF;
31
32
    private $userFriendsWithLimitQuery = <<<'EOF'
33
query {
34
  user {
35
    friends(first: 1) {
36
      edges {
37
        node {
38
          name
39
        }
40
      }
41
    }
42
  }
43
}
44
EOF;
45
46
    public function testComplexityReachLimitation()
47
    {
48
        $expected = [
49
            'errors' => [
50
                [
51
                    'message' => 'Max query complexity should be 10 but got 54.',
52
                ],
53
            ],
54
        ];
55
56
        $this->assertResponse($this->userFriendsWithoutLimitQuery, $expected, self::ANONYMOUS_USER, 'queryComplexity');
57
    }
58
59
    public function testComplexityReachLimitationEnv()
60
    {
61
        $expected = [
62
            'errors' => [
63
                [
64
                    'message' => 'Max query complexity should be 10 but got 54.',
65
                ],
66
            ],
67
        ];
68
69
        $this->assertResponse($this->userFriendsWithoutLimitQuery, $expected, self::ANONYMOUS_USER, 'queryComplexityEnv');
70
    }
71
72
    public function testComplexityUnderLimitation()
73
    {
74
        $expected = [
75
            'data' => [
76
                'user' => [
77
                    'friends' => [
78
                        'edges' => [
79
                            ['node' => ['name' => 'Nick']],
80
                        ],
81
                    ],
82
                ],
83
            ],
84
        ];
85
86
        $this->assertResponse($this->userFriendsWithLimitQuery, $expected, self::ANONYMOUS_USER, 'queryComplexity');
87
    }
88
}
89