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

PhpStanRelatedTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 39
rs 10
c 1
b 0
f 1
wmc 3
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testRelatedMethodsWithoutAutoload() 0 14 1
A testRelatedMethods() 0 21 2
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