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
Pull Request — master (#7)
by Jérémiah
09:02
created

TypeBuilderTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 4
dl 0
loc 56
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testCreate() 0 6 1
A testCreateInvalidType() 0 4 1
A getCreateDataProvider() 0 20 1
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\Definition\Builder;
13
14
use GraphQL\Type\Definition\ObjectType;
15
use Overblog\GraphQLBundle\Definition\Builder\TypeBuilder;
16
use Overblog\GraphQLBundle\Resolver\ConfigResolver;
17
18
class TypeBuilderTest extends \PHPUnit_Framework_TestCase
19
{
20
    /**
21
     * @var TypeBuilder
22
     */
23
    private $typeBuilder;
24
25
    public function setUp()
26
    {
27
        $this->typeBuilder = new TypeBuilder(new ConfigResolver());
28
    }
29
30
    /**
31
     * @param $type
32
     * @param array $config
33
     * @param $expectedInstanceOf
34
     *
35
     * @dataProvider getCreateDataProvider
36
     */
37
    public function testCreate($type, array $config, $expectedInstanceOf)
38
    {
39
        $type = $this->typeBuilder->create($type, $config);
40
41
        $this->assertInstanceOf($expectedInstanceOf, $type);
42
    }
43
44
    /**
45
     * @expectedException \RuntimeException
46
     * @expectedExceptionMessage Type "toto" is not managed.
47
     */
48
    public function testCreateInvalidType()
49
    {
50
        $this->typeBuilder->create('toto', []);
51
    }
52
53
    public function getCreateDataProvider()
54
    {
55
        return [
56
            [
57
                'object', ['name' => 'object'], 'GraphQL\\Type\\Definition\\ObjectType',
58
            ],
59
            [
60
                'enum', ['name' => 'enum'], 'GraphQL\\Type\\Definition\\EnumType',
61
            ],
62
            [
63
                'interface', ['name' => 'interface'], 'GraphQL\\Type\\Definition\\InterfaceType',
64
            ],
65
            [
66
                'union', ['name' => 'union', 'types' => [new ObjectType(['name' => 'toto'])]], 'GraphQL\\Type\\Definition\\UnionType',
67
            ],
68
            [
69
                'input-object', ['name' => 'input'], 'GraphQL\\Type\\Definition\\InputObjectType',
70
            ],
71
        ];
72
    }
73
}
74