| Conditions | 2 |
| Paths | 3 |
| Total Lines | 21 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 9 | public function testRelatedMethods() |
||
|
|
|||
| 10 | { |
||
| 11 | $GLOBALS['argv'] = [ |
||
| 12 | 'diffFilter', |
||
| 13 | '--phpstan', |
||
| 14 | '--autoload=' . __DIR__ . '/fixtures/phpstanTypeError.php', |
||
| 15 | __DIR__ . '/fixtures/addTypeError.txt', |
||
| 16 | __DIR__ . '/fixtures/phpstanTypeError.txt' |
||
| 17 | ]; |
||
| 18 | |||
| 19 | try { |
||
| 20 | ob_start(); |
||
| 21 | require(__DIR__ . "/../src/Runners/generic.php"); |
||
| 22 | } catch (Exception $exception) { |
||
| 23 | $output = ob_get_clean(); |
||
| 24 | $this->assertContains('used test.php', $output); |
||
| 25 | return true; |
||
| 26 | } |
||
| 27 | |||
| 28 | $this->fail('Exception not thrown when Expected'); |
||
| 29 | } |
||
| 30 | } |
||
| 31 |
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: