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

Completed
Push — annotations ( a85f92...4ec00b )
by Jérémiah
24:35 queued 10s
created

AbstractStarWarsTest::assertValidQuery()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
/*
4
 * This file is part of the OverblogGraphQLPhpGenerator 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\GraphQLGenerator\Tests;
13
14
use GraphQL\Error\Debug;
15
use GraphQL\GraphQL;
16
use GraphQL\Type\Schema;
17
use Overblog\GraphQLGenerator\Tests\Generator\AbstractTypeGeneratorTest;
18
19
abstract class AbstractStarWarsTest extends AbstractTypeGeneratorTest
20
{
21
    /**
22
     * @var Schema
23
     */
24
    protected $schema;
25
26
    public function setUp()
27
    {
28
        parent::setUp();
29
30
        $this->classLoader->setPsr4('GraphQL\\Tests\\', __DIR__.'/../vendor/webonyx/graphql-php/tests');
31
32
        $this->generateClasses();
33
34
        Resolver::setHumanType($this->getType('Human'));
35
        Resolver::setDroidType($this->getType('Droid'));
36
37
        $this->schema = new Schema(['query' => $this->getType('Query')]);
38
        $this->schema->assertValid();
39
    }
40
41
    /**
42
     * Helper function to test a query and the expected response.
43
     * @param $query
44
     * @param $expected
45
     * @param null $variables
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $variables is correct as it would always require null to be passed?
Loading history...
46
     */
47
    protected function assertValidQuery($query, $expected, $variables = null)
48
    {
49
        $actual = GraphQL::executeQuery($this->schema, $query, null, null, $variables)
50
            ->toArray(Debug::INCLUDE_DEBUG_MESSAGE | Debug::INCLUDE_TRACE);
51
        $expected = ['data' => $expected];
52
        $this->assertEquals($expected, $actual, \json_encode($actual));
53
    }
54
55
    protected function sortSchemaEntry(array &$entries, $entryKey, $sortBy)
56
    {
57
        if (isset($entries['data']['__schema'][$entryKey])) {
58
            $data = &$entries['data']['__schema'][$entryKey];
59
        } else {
60
            $data = &$entries['__schema'][$entryKey];
61
        }
62
63
        \usort($data, function ($data1, $data2) use ($sortBy) {
64
            return \strcmp($data1[$sortBy], $data2[$sortBy]);
65
        });
66
    }
67
}
68