GenericDiffFilterTest::testValid()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 12
rs 9.9666
c 0
b 0
f 0
1
<?php
2
namespace exussum12\CoverageChecker\tests;
3
4
use Exception;
5
use PHPUnit\Framework\TestCase;
6
7
/**
8
 * Ignored due to acceptance test needing to write values
9
 * @SuppressWarnings(PHPMD.Superglobals)
10
 */
11
class GenericDiffFilterTest extends TestCase
12
{
13
14
    public function testValid()
15
    {
16
        $GLOBALS['argv'] = [
17
            'diffFilter',
18
            '--phpcs',
19
            __DIR__ . '/fixtures/change.txt',
20
            __DIR__ . '/fixtures/phpcs.json'
21
        ];
22
        ob_start();
23
        require(__DIR__ . "/../src/Runners/generic.php");
24
        $output = ob_get_clean();
25
        $this->assertContains('100.00%', $output);
26
    }
27
28
    public function testMissingHandler()
29
    {
30
        $GLOBALS['argv'] = [
31
            'diffFilter',
32
            __DIR__ . '/fixtures/change.txt',
33
            __DIR__ . '/fixtures/phpcs.json'
34
        ];
35
        try {
36
            ob_start();
37
            require(__DIR__ . "/../src/Runners/generic.php");
38
        } catch (Exception $exception) {
39
            $output = ob_get_clean();
40
            $this->assertContains('--phpcs', $output);
41
            return true;
42
        }
43
44
        $this->fail('Exception not thrown when Expected');
45
    }
46
}
47