Failed Conditions
Push — master ( 1d20e4...3402cb )
by Marco
01:06 queued 13s
created

BinaryTest::testSuccess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace ComposerRequireCheckerTest;
4
5
use function implode;
6
use PHPUnit\Framework\TestCase;
7
8
class BinaryTest extends TestCase
9
{
10
    /** @var string */
11
    private $bin;
12
13
    public function setUp(): void
14
    {
15
        $this->bin = __DIR__ . "/../../bin/composer-require-checker";
16
    }
17
18
    public function testSuccess()
19
    {
20
        exec($this->bin, $output, $return);
21
        $this->assertSame(0, $return);
22
    }
23
24
    public function testUnknownSymbols()
25
    {
26
        $path = __DIR__ . "/../fixtures/unknownSymbols/composer.json";
27
        exec("{$this->bin} check {$path} 2>&1", $output, $return);
28
        $this->assertSame(1, $return);
29
        $this->assertContains("The following unknown symbols were found", implode("\n", $output));
30
    }
31
32
    public function testInvalidConfiguration()
33
    {
34
        $path = __DIR__ . "/../fixtures/validJson.json";
35
        exec("{$this->bin} check {$path} 2>&1", $output, $return);
36
        $this->assertSame(1, $return);
37
        $this->assertContains("please check your configuration", implode("\n", $output));
38
    }
39
}
40