Completed
Push — master ( 53b32d...31d14d )
by Scott
17s
created

PhpmndDiffFilterTest::testValid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 10
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 13
rs 9.4285
1
<?php
2
namespace exussum12\CoverageChecker\tests;
3
4
use PHPUnit\Framework\TestCase;
5
use Exception;
6
7
class PhpmndDiffFilterTest extends TestCase
8
{
9
10
    public function testValid()
0 ignored issues
show
Coding Style introduced by
testValid uses the super-global variable $GLOBALS which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
11
    {
12
        $GLOBALS['argv'] = [
13
            'phpunitDiffFilter',
14
            '--phpmnd',
15
            __DIR__ . '/fixtures/change.txt',
16
            __DIR__ . '/fixtures/phpmnd.txt'
17
        ];
18
        ob_start();
19
        require(__DIR__ . "/../src/Runners/generic.php");
20
        $output = ob_get_clean();
21
        $this->assertContains('100.00%', $output);
22
    }
23
}
24