Completed
Push — master ( aae28f...8c0ca5 )
by Matthias
17s
created

CheckCommandTest::testSelfCheckShowsNoErrors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace ComposerRequireCheckerTest\Cli;
4
5
use ComposerRequireChecker\Cli\Application;
6
use PHPUnit\Framework\TestCase;
7
use Symfony\Component\Console\Tester\CommandTester;
8
9
class CheckCommandTest extends TestCase
10
{
11
12
    /**
13
     * @var CommandTester
14
     */
15
    private $commandTester;
16
17
    public function setUp()
18
    {
19
        $application = new Application();
20
        $command = $application->get('check');
21
22
        $this->commandTester = new CommandTester($command);
23
    }
24
25
    public function testExceptionIfComposerJsonNotFound()
26
    {
27
        self::expectException(\InvalidArgumentException::class);
28
29
        $this->commandTester->execute([
30
            'composer-json' => 'this-will-not-be-found.json'
31
        ]);
32
    }
33
34
    public function testSelfCheckShowsNoErrors()
35
    {
36
        $this->commandTester->execute([
37
            // that's our own composer.json, lets be sure our self check does not throw errors
38
            'composer-json' => dirname(__DIR__, 3) . '/composer.json'
39
        ]);
40
41
        $this->assertSame(0, $this->commandTester->getStatusCode());
42
        $this->assertContains('no unknown symbols found', $this->commandTester->getDisplay());
43
    }
44
45
}