Completed
Pull Request — master (#30)
by Scott
02:21
created

testRelatedMethodsWithoutAutoload()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 0
dl 0
loc 14
rs 9.4285
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 PhpStanRelatedTest extends TestCase
12
{
13
    public function testRelatedMethodsWithoutAutoload()
14
    {
15
        $GLOBALS['argv'] = [
16
            'diffFilter',
17
            '--phpstan',
18
            __DIR__ . '/fixtures/addTypeError.txt',
19
            __DIR__ . '/fixtures/phpstanTypeError.txt'
20
        ];
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 testRelatedMethods()
29
    {
30
        $GLOBALS['argv'] = [
31
            'diffFilter',
32
            '--phpstan',
33
            '--autoload=' . __DIR__ . '/fixtures/phpstanTypeError.php',
34
            __DIR__ . '/fixtures/addTypeError.txt',
35
            __DIR__ . '/fixtures/phpstanTypeError.txt'
36
        ];
37
38
        try {
39
            ob_start();
40
            require(__DIR__ . "/../src/Runners/generic.php");
41
        } catch (Exception $exception) {
42
            $output = ob_get_clean();
43
            $this->assertContains('used test.php', $output);
44
            return true;
45
        }
46
47
        $this->fail('Exception not thrown when Expected');
48
    }
49
}
50