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 (#137)
by Jérémiah
05:56
created

DebugCommandTest::categoryDataProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
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\Functional\Command;
13
14
use Overblog\GraphQLBundle\Command\DebugCommand;
15
use Overblog\GraphQLBundle\Tests\Functional\TestCase;
16
use Symfony\Bundle\FrameworkBundle\Console\Application;
17
use Symfony\Component\Console\Command\Command;
18
use Symfony\Component\Console\Tester\CommandTester;
19
20
class DebugCommandTest extends TestCase
21
{
22
    /**
23
     * @var Command
24
     */
25
    private $command;
26
27
    /**
28
     * @var CommandTester
29
     */
30
    private $commandTester;
31
32
    private $logs = [];
33
34
    public function setUp()
35
    {
36
        parent::setUp();
37
        $client = static::createClient(['test_case' => 'mutation']);
38
        $kernel = $client->getKernel();
39
40
        $application = new Application($kernel);
41
        $application->add(new DebugCommand());
42
        $this->command = $application->find('graphql:debug');
43
        $this->commandTester = new CommandTester($this->command);
44
        foreach (DebugCommand::getCategories() as $category) {
45
            $this->logs[$category] = trim(str_replace('ø', '', file_get_contents(__DIR__.'/fixtures/debug-'.$category.'.txt')));
46
        }
47
    }
48
49
    /**
50
     * @param array $categories
51
     * @dataProvider categoryDataProvider
52
     */
53
    public function testProcess(array $categories)
54
    {
55
        $input = [
56
            'command' => $this->command->getName(),
57
        ];
58
        if (empty($categories)) {
59
            $categories = DebugCommand::getCategories();
60
        } else {
61
            $input['--category'] = $categories;
62
        }
63
64
        $this->commandTester->execute($input);
65
        $this->assertEquals(0, $this->commandTester->getStatusCode());
66
        $expected = "\n";
67
        foreach ($categories as $category) {
68
            $expected .= $this->logs[$category]." \n\n\n\n";
69
        }
70
71
        $this->assertEquals($expected, $this->commandTester->getDisplay());
72
    }
73
74
    /**
75
     * @expectedException \InvalidArgumentException
76
     * @expectedExceptionMessage Invalid category (fake)
77
     */
78
    public function testInvalidFormat()
79
    {
80
        $this->commandTester->execute([
81
            'command' => $this->command->getName(),
82
            '--category' => 'fake',
83
        ]);
84
    }
85
86
    public function categoryDataProvider()
87
    {
88
        return [
89
            [[]],
90
            [['type']],
91
            [['resolver']],
92
            [['mutation']],
93
            [['type', 'mutation']],
94
        ];
95
    }
96
}
97