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
22:38 queued 19:05
created

ConfigProcessorTest::testOrderByPriorityDesc()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 29
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 18
nc 1
nop 0
1
<?php
2
3
namespace Overblog\GraphQLBundle\Tests\Definition;
4
5
use Overblog\GraphQLBundle\Definition\ConfigProcessor;
6
use Overblog\GraphQLBundle\Definition\LazyConfig;
7
use Overblog\GraphQLBundle\Tests\Definition\ConfigProcessor\NullConfigProcessor;
8
use PHPUnit\Framework\TestCase;
9
10
class ConfigProcessorTest extends TestCase
11
{
12
    /**
13
     * @expectedException \LogicException
14
     * @expectedExceptionMessage Registering config processor after calling process() is not supported.
15
     */
16
    public function testThrowExceptionWhenAddingAConfigProcessorAfterInitialization()
17
    {
18
        $configProcessor = new ConfigProcessor();
19
        $configProcessor->addConfigProcessor(new NullConfigProcessor());
20
21
        $configProcessor->process(LazyConfig::create(function () {
22
            return [];
23
        }));
24
25
        $configProcessor->addConfigProcessor(new NullConfigProcessor());
26
    }
27
28
    public function testOrderByPriorityDesc()
29
    {
30
        $configProcessor = new ConfigProcessor();
31
32
        $configProcessor->addConfigProcessor($nullConfigProcessor1 = new NullConfigProcessor());
33
        $configProcessor->addConfigProcessor($nullConfigProcessor2 = new NullConfigProcessor(), 4);
34
        $configProcessor->addConfigProcessor($nullConfigProcessor3 = new NullConfigProcessor(), 256);
35
        $configProcessor->addConfigProcessor($nullConfigProcessor4 = new NullConfigProcessor());
36
        $configProcessor->addConfigProcessor($nullConfigProcessor5 = new NullConfigProcessor(), 512);
37
38
        $configProcessor->process(LazyConfig::create(function () {
39
            return [];
40
        }));
41
42
        $getOrderedProcessors = \Closure::bind(
43
            function () {
44
                return $this->orderedProcessors;
0 ignored issues
show
Bug introduced by
The property orderedProcessors does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
45
            },
46
            $configProcessor,
47
            get_class($configProcessor)
48
        );
49
50
        $processors = $getOrderedProcessors();
51
52
        $this->assertSame(
53
            $processors,
54
            [$nullConfigProcessor5, $nullConfigProcessor3, $nullConfigProcessor2, $nullConfigProcessor1, $nullConfigProcessor4]
55
        );
56
    }
57
}
58