@@ 9-20 (lines=12) @@ | ||
6 | class PhpcsDiffFilterTest extends TestCase |
|
7 | { |
|
8 | ||
9 | public function testValid() |
|
10 | { |
|
11 | $GLOBALS['argv'] = [ |
|
12 | 'phpunitDiffFilter', |
|
13 | __DIR__ . '/fixtures/change.txt', |
|
14 | __DIR__ . '/fixtures/phpcs.json' |
|
15 | ]; |
|
16 | ob_start(); |
|
17 | require(__DIR__ . "/../src/runners/phpcsDiffFilter.php"); |
|
18 | $output = ob_get_clean(); |
|
19 | $this->assertContains('100.00%', $output); |
|
20 | } |
|
21 | ||
22 | public function testStrictMode() |
|
23 | { |
|
@@ 22-33 (lines=12) @@ | ||
19 | $this->assertContains('100.00%', $output); |
|
20 | } |
|
21 | ||
22 | public function testStrictMode() |
|
23 | { |
|
24 | $GLOBALS['argv'] = [ |
|
25 | 'phpunitDiffFilter', |
|
26 | __DIR__ . '/fixtures/change.txt', |
|
27 | __DIR__ . '/fixtures/phpcsstrict.json' |
|
28 | ]; |
|
29 | ob_start(); |
|
30 | require(__DIR__ . "/../src/runners/phpcsDiffFilter.php"); |
|
31 | $output = ob_get_clean(); |
|
32 | $this->assertContains('100.00%', $output); |
|
33 | } |
|
34 | } |
|
35 |
@@ 10-21 (lines=12) @@ | ||
7 | class PhpmdDiffFilterTest extends TestCase |
|
8 | { |
|
9 | ||
10 | public function testValid() |
|
11 | { |
|
12 | $GLOBALS['argv'] = [ |
|
13 | 'phpunitDiffFilter', |
|
14 | __DIR__ . '/fixtures/change.txt', |
|
15 | __DIR__ . '/fixtures/phpmd.xml' |
|
16 | ]; |
|
17 | ob_start(); |
|
18 | require(__DIR__ . "/../src/runners/phpmdDiffFilter.php"); |
|
19 | $output = ob_get_clean(); |
|
20 | $this->assertContains('100.00%', $output); |
|
21 | } |
|
22 | ||
23 | public function testNoValidLines() |
|
24 | { |
@@ 19-30 (lines=12) @@ | ||
16 | require(__DIR__ . "/../src/runners/phpunitDiffFilter.php"); |
|
17 | } |
|
18 | ||
19 | public function testWorkingCorrectly() |
|
20 | { |
|
21 | $GLOBALS['argv'] = [ |
|
22 | 'phpunitDiffFilter', |
|
23 | __DIR__ . '/fixtures/change.txt', |
|
24 | __DIR__ . '/fixtures/coverage.xml' |
|
25 | ]; |
|
26 | ob_start(); |
|
27 | require(__DIR__ . "/../src/runners/phpunitDiffFilter.php"); |
|
28 | $output = ob_get_clean(); |
|
29 | $this->assertContains('100.00%', $output); |
|
30 | } |
|
31 | ||
32 | public function testFailingBuild() |
|
33 | { |
|
@@ 53-66 (lines=14) @@ | ||
50 | $this->fail("no exception thrown"); |
|
51 | } |
|
52 | ||
53 | public function testPassingLowPercentage() |
|
54 | { |
|
55 | $GLOBALS['argv'] = [ |
|
56 | 'phpunitDiffFilter', |
|
57 | __DIR__ . '/fixtures/newFile.txt', |
|
58 | __DIR__ . '/fixtures/coverage-change.xml', |
|
59 | 60 |
|
60 | ]; |
|
61 | ||
62 | ob_start(); |
|
63 | require(__DIR__ . "/../src/runners/phpunitDiffFilter.php"); |
|
64 | $output = ob_get_clean(); |
|
65 | $this->assertContains('66.67%', $output); |
|
66 | } |
|
67 | ||
68 | public function testNoCoveredLines() |
|
69 | { |
|
@@ 68-80 (lines=13) @@ | ||
65 | $this->assertContains('66.67%', $output); |
|
66 | } |
|
67 | ||
68 | public function testNoCoveredLines() |
|
69 | { |
|
70 | $GLOBALS['argv'] = [ |
|
71 | 'phpunitDiffFilter', |
|
72 | __DIR__ . '/fixtures/removeFile.txt', |
|
73 | __DIR__ . '/fixtures/coverage-change.xml', |
|
74 | ]; |
|
75 | ||
76 | ob_start(); |
|
77 | require(__DIR__ . "/../src/runners/phpunitDiffFilter.php"); |
|
78 | $output = ob_get_clean(); |
|
79 | $this->assertContains('No lines found', $output); |
|
80 | } |
|
81 | } |
|
82 |