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 (#101)
by Jérémiah
07:00
created

NodeFieldDefinitionTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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\Relay\Node;
13
14
use Overblog\GraphQLBundle\Relay\Node\NodeFieldDefinition;
15
16
class NodeFieldDefinitionTest extends \PHPUnit_Framework_TestCase
17
{
18
    /**
19
     * @var NodeFieldDefinition
20
     */
21
    private $definition;
22
23
    public function setUp()
24
    {
25
        $this->definition = new NodeFieldDefinition();
26
    }
27
28
    /**
29
     * @expectedException \InvalidArgumentException
30
     * @expectedExceptionMessage Node "idFetcher" config is invalid.
31
     */
32
    public function testUndefinedIdFetcherConfig()
33
    {
34
        $this->definition->toMappingDefinition([]);
35
    }
36
37
    /**
38
     * @expectedException \InvalidArgumentException
39
     * @expectedExceptionMessage Node "idFetcher" config is invalid.
40
     */
41
    public function testIdFetcherConfigSetButIsNotString()
42
    {
43
        $this->definition->toMappingDefinition(['idFetcher' => 45]);
44
    }
45
46
    /**
47
     * @dataProvider validConfigProvider
48
     *
49
     * @param $idFetcher
50
     * @param $idFetcherCallbackArg
51
     * @param $nodeInterfaceType
52
     */
53 View Code Duplication
    public function testValidConfig($idFetcher, $idFetcherCallbackArg, $nodeInterfaceType = 'node')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
54
    {
55
        $config = [
56
            'idFetcher' => $idFetcher,
57
            'inputType' => 'UserInput',
58
            'nodeInterfaceType' => $nodeInterfaceType,
59
        ];
60
61
        $expected = [
62
            'description' => 'Fetches an object given its ID',
63
            'type' => $nodeInterfaceType,
64
            'args' => ['id' => ['type' => 'ID!', 'description' => 'The ID of an object']],
65
            'resolve' => '@=resolver(\'relay_node_field\', [args, idFetcherCallback('.$idFetcherCallbackArg.')])',
66
        ];
67
68
        $this->assertEquals($expected, $this->definition->toMappingDefinition($config));
69
    }
70
71
    public function validConfigProvider()
72
    {
73
        return [
74
            ['@=user.username', 'user.username'],
75
            ['toto', 'toto'],
76
            ['50', '50'],
77
            ['@=user.id', 'user.id', 'NodeInterface'],
78
        ];
79
    }
80
}
81