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

BinaryTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 12
dl 0
loc 30
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testUnknownSymbols() 0 6 1
A testInvalidConfiguration() 0 6 1
A testSuccess() 0 4 1
A setUp() 0 3 1
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