@@ 23-41 (lines=19) @@ | ||
20 | $this->assertContains('100.00%', $output); |
|
21 | } |
|
22 | ||
23 | public function testNoValidLines() |
|
24 | { |
|
25 | $GLOBALS['argv'] = [ |
|
26 | 'phpunitDiffFilter', |
|
27 | __DIR__ . '/fixtures/change.txt', |
|
28 | __DIR__ . '/fixtures/phpmd-change.xml', |
|
29 | ]; |
|
30 | try { |
|
31 | ob_start(); |
|
32 | require(__DIR__ . "/../src/runners/phpmdDiffFilter.php"); |
|
33 | } catch (Exception $e) { |
|
34 | $output = ob_get_clean(); |
|
35 | $this->assertEquals(2, $e->getCode()); |
|
36 | $this->assertContains('0.00%', $output); |
|
37 | return; |
|
38 | } |
|
39 | $this->fail("no exception thrown"); |
|
40 | ||
41 | } |
|
42 | ||
43 | public function testNoValidLinesStrict() |
|
44 | { |
|
@@ 43-62 (lines=20) @@ | ||
40 | ||
41 | } |
|
42 | ||
43 | public function testNoValidLinesStrict() |
|
44 | { |
|
45 | $GLOBALS['argv'] = [ |
|
46 | 'phpunitDiffFilter', |
|
47 | __DIR__ . '/fixtures/change.txt', |
|
48 | __DIR__ . '/fixtures/phpmd-change.xml', |
|
49 | '--strict', |
|
50 | ]; |
|
51 | try { |
|
52 | ob_start(); |
|
53 | require(__DIR__ . "/../src/runners/phpmdDiffFilter.php"); |
|
54 | } catch (Exception $e) { |
|
55 | $output = ob_get_clean(); |
|
56 | $this->assertEquals(2, $e->getCode()); |
|
57 | $this->assertContains('0%', $output); |
|
58 | return; |
|
59 | } |
|
60 | ||
61 | $this->fail("no exception thrown"); |
|
62 | } |
|
63 | } |
|
64 |
@@ 32-51 (lines=20) @@ | ||
29 | $this->assertContains('100.00%', $output); |
|
30 | } |
|
31 | ||
32 | public function testFailingBuild() |
|
33 | { |
|
34 | $GLOBALS['argv'] = [ |
|
35 | 'phpunitDiffFilter', |
|
36 | __DIR__ . '/fixtures/newFile.txt', |
|
37 | __DIR__ . '/fixtures/coverage-change.xml', |
|
38 | 70 |
|
39 | ]; |
|
40 | try { |
|
41 | ob_start(); |
|
42 | require(__DIR__ . "/../src/runners/phpunitDiffFilter.php"); |
|
43 | } catch (Exception $e) { |
|
44 | $output = ob_get_clean(); |
|
45 | $this->assertEquals(2, $e->getCode()); |
|
46 | $this->assertContains('66.67%', $output); |
|
47 | return; |
|
48 | } |
|
49 | ||
50 | $this->fail("no exception thrown"); |
|
51 | } |
|
52 | ||
53 | public function testPassingLowPercentage() |
|
54 | { |