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 (#119)
by Jérémiah
14:40
created

GraphDumpSchemaCommandTest::testExecute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 9.2
c 0
b 0
f 0
cc 1
eloc 13
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\GraphQLDumpSchemaCommand;
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 GraphDumpSchemaCommandTest extends TestCase
21
{
22
    /**
23
     * @var Command
24
     */
25
    private $command;
26
27
    /**
28
     * @var CommandTester
29
     */
30
    private $commandTester;
31
32
    /**
33
     * @var string
34
     */
35
    private $cacheDir;
36
37
    public function setUp()
38
    {
39
        parent::setUp();
40
        $client = static::createClient(['test_case' => 'connection']);
41
        $kernel = $client->getKernel();
42
43
        $application = new Application($kernel);
44
        $application->add(new GraphQLDumpSchemaCommand());
45
        $this->command = $application->find('graph:dump-schema');
46
        $this->commandTester = new CommandTester($this->command);
47
        $this->cacheDir = $kernel->getCacheDir();
48
    }
49
50
    /**
51
     * @param $format
52
     * @param bool $withFormatOption
53
     * @dataProvider formatDataProvider
54
     */
55
    public function testDump($format, $withFormatOption = true)
56
    {
57
        $file = $this->cacheDir.'/schema.'.$format;
58
59
        $input = [
60
            'command' => $this->command->getName(),
61
            '--file' => $file,
62
        ];
63
64
        if ($withFormatOption) {
65
            $input['--format'] = $format;
66
        }
67
        $this->commandTester->execute($input);
68
69
        $this->assertEquals(0, $this->commandTester->getStatusCode());
70
        $this->assertEquals(trim(file_get_contents(__DIR__.'/schema.'.$format)), trim(file_get_contents($file)));
71
    }
72
73
    /**
74
     * @expectedException \InvalidArgumentException
75
     * @expectedExceptionMessage Unknown format "fake".
76
     */
77
    public function testInvalidFormat()
78
    {
79
        $this->commandTester->execute([
80
            'command' => $this->command->getName(),
81
            '--format' => 'fake',
82
        ]);
83
    }
84
85
    public function formatDataProvider()
86
    {
87
        return [
88
            ['json', false],
89
            ['json', true],
90
            ['graphqls'],
91
        ];
92
    }
93
}
94