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
Push — master ( 6eaf22...743834 )
by Renato
56s
created

InheritanceProcessorTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 58
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testExtendsUnknownType() 0 7 1
A testHeirsUnknownType() 0 7 1
A testCircularExtendsType() 0 7 1
A testNotAllowedType() 0 7 1
1
<?php
2
3
namespace Overblog\GraphQLBundle\Tests\Config;
4
5
use Overblog\GraphQLBundle\Config\Processor\InheritanceProcessor;
6
use PHPUnit\Framework\TestCase;
7
8
class InheritanceProcessorTest extends TestCase
9
{
10
    private $fixtures = [
11
        'foo' => [InheritanceProcessor::INHERITS_KEY => ['bar', 'baz'], 'type' => 'object', 'config' => []],
12
        'bar' => [InheritanceProcessor::INHERITS_KEY => ['toto'], 'type' => 'object', 'config' => []],
13
        'baz' => ['type' => 'object', 'config' => []],
14
        'toto' => ['type' => 'interface', 'config' => []],
15
        'tata' => ['type' => 'interface', InheritanceProcessor::HEIRS_KEY => ['foo'], 'config' => []],
16
    ];
17
18
    /**
19
     * @expectedException \InvalidArgumentException
20
     * @expectedExceptionMessage Type "toto" inherits by "bar" not found.
21
     */
22
    public function testExtendsUnknownType()
23
    {
24
        $configs = $this->fixtures;
25
        unset($configs['toto']);
26
27
        InheritanceProcessor::process($configs);
28
    }
29
30
    /**
31
     * @expectedException \InvalidArgumentException
32
     * @expectedExceptionMessage Type "foo" child of "tata" not found.
33
     */
34
    public function testHeirsUnknownType()
35
    {
36
        $configs = $this->fixtures;
37
        unset($configs['foo']);
38
39
        InheritanceProcessor::process($configs);
40
    }
41
42
    /**
43
     * @expectedException \InvalidArgumentException
44
     * @expectedExceptionMessage Type circular inheritance detected (foo->bar->toto->foo).
45
     */
46
    public function testCircularExtendsType()
47
    {
48
        $configs = $this->fixtures;
49
        $configs['toto'][InheritanceProcessor::INHERITS_KEY] = ['foo'];
50
51
        InheritanceProcessor::process($configs);
52
    }
53
54
    /**
55
     * @expectedException \InvalidArgumentException
56
     * @expectedExceptionMessage Type "toto" can't inherits "bar" because "enum" is not allowed type (["object","interface"]).
57
     */
58
    public function testNotAllowedType()
59
    {
60
        $configs = $this->fixtures;
61
        $configs['toto']['type'] = 'enum';
62
63
        InheritanceProcessor::process($configs);
64
    }
65
}
66