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 — master (#277)
by Jérémiah
14:57
created

NodeTest::testHasCorrectNodeInterface()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 42
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 42
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 16
nc 1
nop 0
1
<?php
2
3
namespace Overblog\GraphQLBundle\Tests\Functional\Relay\Node;
4
5
use Overblog\GraphQLBundle\Tests\Functional\TestCase;
6
7
/**
8
 * Class NodeTest.
9
 *
10
 * @see https://github.com/graphql/graphql-relay-js/blob/master/src/node/__tests__/node.js
11
 */
12
class NodeTest extends TestCase
13
{
14
    protected function setUp()
15
    {
16
        parent::setUp();
17
18
        static::bootKernel(['test_case' => 'node']);
19
    }
20
21
    public function testNodeInterfaceAndFields()
22
    {
23
        $query = <<<'EOF'
24
{
25
  node(id: "1") {
26
    id
27
  }
28
}
29
EOF;
30
31
        $expectedData = [
32
            'node' => [
33
                'id' => '1',
34
            ],
35
        ];
36
37
        $this->assertGraphQL($query, $expectedData);
38
    }
39
40
    public function testGetsTheCorrectIdForPhotos()
41
    {
42
        $query = <<<'EOF'
43
{
44
  node(id: "4") {
45
    id
46
  }
47
}
48
EOF;
49
50
        $expectedData = [
51
            'node' => [
52
                'id' => '4',
53
            ],
54
        ];
55
56
        $this->assertGraphQL($query, $expectedData);
57
    }
58
59
    public function testGetsTheCorrectWidthForPhotos()
60
    {
61
        $query = <<<'EOF'
62
{
63
  node(id: "4") {
64
    id
65
    ... on Photo {
66
      width
67
    }
68
  }
69
}
70
EOF;
71
72
        $expectedData = [
73
            'node' => [
74
                'id' => '4',
75
                'width' => 400,
76
            ],
77
        ];
78
79
        $this->assertGraphQL($query, $expectedData);
80
    }
81
82
    public function testGetsTheCorrectTypeNameForUsers()
83
    {
84
        $query = <<<'EOF'
85
{
86
  node(id: "1") {
87
    id
88
    __typename
89
  }
90
}
91
EOF;
92
93
        $expectedData = [
94
            'node' => [
95
                'id' => '1',
96
                '__typename' => 'User',
97
            ],
98
        ];
99
100
        $this->assertGraphQL($query, $expectedData);
101
    }
102
103
    public function testGetsTheCorrectTypeNameForPhotos()
104
    {
105
        $query = <<<'EOF'
106
{
107
  node(id: "4") {
108
    id
109
    __typename
110
  }
111
}
112
EOF;
113
114
        $expectedData = [
115
            'node' => [
116
                'id' => '4',
117
                '__typename' => 'Photo',
118
            ],
119
        ];
120
121
        $this->assertGraphQL($query, $expectedData);
122
    }
123
124
    public function testIgnoresPhotoFragmentsOnUser()
125
    {
126
        $query = <<<'EOF'
127
{
128
  node(id: "1") {
129
    id
130
    ... on Photo {
131
      width
132
    }
133
  }
134
}
135
EOF;
136
137
        $expectedData = [
138
            'node' => [
139
                'id' => '1',
140
            ],
141
        ];
142
143
        $this->assertGraphQL($query, $expectedData);
144
    }
145
146
    public function testReturnsNullForBadIds()
147
    {
148
        $query = <<<'EOF'
149
{
150
  node(id: "5") {
151
    id
152
  }
153
}
154
EOF;
155
156
        $expectedData = [
157
            'node' => null,
158
        ];
159
160
        $this->assertGraphQL($query, $expectedData);
161
    }
162
163
    public function testHasCorrectNodeInterface()
164
    {
165
        $query = <<<'EOF'
166
{
167
        __type(name: "Node") {
168
          name
169
          kind
170
          fields {
171
            name
172
            type {
173
              kind
174
              ofType {
175
                name
176
                kind
177
              }
178
            }
179
          }
180
        }
181
      }
182
EOF;
183
184
        $expectedData = [
185
            '__type' => [
186
                'name' => 'Node',
187
                'kind' => 'INTERFACE',
188
                'fields' => [
189
                    [
190
                        'name' => 'id',
191
                        'type' => [
192
                            'kind' => 'NON_NULL',
193
                            'ofType' => [
194
                                'name' => 'ID',
195
                                'kind' => 'SCALAR',
196
                            ],
197
                        ],
198
                    ],
199
                ],
200
            ],
201
        ];
202
203
        $this->assertGraphQL($query, $expectedData);
204
    }
205
206
    public function testHasCorrectNodeRootField()
207
    {
208
        $query = <<<'EOF'
209
{
210
        __schema {
211
          queryType {
212
            fields {
213
              name
214
              type {
215
                name
216
                kind
217
              }
218
              args {
219
                name
220
                type {
221
                  kind
222
                  ofType {
223
                    name
224
                    kind
225
                  }
226
                }
227
              }
228
            }
229
          }
230
        }
231
      }
232
EOF;
233
234
        $expectedData = [
235
            '__schema' => [
236
                'queryType' => [
237
                    'fields' => [
238
                        [
239
                            'name' => 'node',
240
                            'type' => [
241
                                'name' => 'Node',
242
                                'kind' => 'INTERFACE',
243
                            ],
244
                            'args' => [
245
                                [
246
                                    'name' => 'id',
247
                                    'type' => [
248
                                        'kind' => 'NON_NULL',
249
                                        'ofType' => [
250
                                            'name' => 'ID',
251
                                            'kind' => 'SCALAR',
252
                                        ],
253
                                    ],
254
                                ],
255
                            ],
256
                        ],
257
                    ],
258
                ],
259
            ],
260
        ];
261
262
        $this->assertGraphQL($query, $expectedData);
263
    }
264
}
265