Skip to content

Commit 28716f2

Browse files
committed
report unit tests
1 parent a606214 commit 28716f2

14 files changed

Lines changed: 268 additions & 16 deletions

File tree

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"phpunit/php-code-coverage": "*"
1313
},
1414
"require-dev": {
15-
"phpunit/phpunit": "3.7.*"
15+
"phpunit/phpunit": "3.7.*",
16+
"mikey179/vfsStream": "*"
1617
},
1718
"autoload": {
1819
"psr-0": {

composer.lock

Lines changed: 31 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/VIPSoft/CodeCoverageCommon/Report/Clover.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ public function __construct(array $options)
4949
*/
5050
public function process(\PHP_CodeCoverage $coverage)
5151
{
52-
return $this->report(
52+
return $this->report->process(
5353
$coverage,
54-
$options['target'],
55-
$options['name']
54+
$this->options['target'],
55+
$this->options['name']
5656
);
5757
}
5858
}

src/VIPSoft/CodeCoverageCommon/Report/Crap4j.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ public function __construct(array $options)
5353
*/
5454
public function process(\PHP_CodeCoverage $coverage)
5555
{
56-
return $this->report(
56+
return $this->report->process(
5757
$coverage,
58-
$options['target'],
59-
$options['name']
58+
$this->options['target'],
59+
$this->options['name']
6060
);
6161
}
6262
}

src/VIPSoft/CodeCoverageCommon/Report/Html.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ public function __construct(array $options)
7272
*/
7373
public function process(\PHP_CodeCoverage $coverage)
7474
{
75-
return $this->report(
75+
return $this->report->process(
7676
$coverage,
77-
$options['target']
77+
$this->options['target']
7878
);
7979
}
8080
}

src/VIPSoft/CodeCoverageCommon/Report/Php.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ public function __construct(array $options)
4545
*/
4646
public function process(\PHP_CodeCoverage $coverage)
4747
{
48-
return $this->report(
48+
return $this->report->process(
4949
$coverage,
50-
$options['target']
50+
$this->options['target']
5151
);
5252
}
5353
}

src/VIPSoft/CodeCoverageCommon/Report/Text.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ public function __construct(array $options)
8282
*/
8383
public function process(\PHP_CodeCoverage $coverage)
8484
{
85-
return $this->report(
85+
return $this->report->process(
8686
$coverage,
87-
$options['showColors']
87+
$this->options['showColors']
8888
);
8989
}
9090

src/VIPSoft/CodeCoverageCommon/Report/Xml.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public function __construct(array $options)
4949
*/
5050
public function process(\PHP_CodeCoverage $coverage)
5151
{
52-
return $this->report(
52+
return $this->report->process(
5353
$coverage,
54-
$options['target']
54+
$this->options['target']
5555
);
5656
}
5757
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* Clover Report
4+
*
5+
* @copyright 2013 Anthon Pang
6+
* @license BSD-2-Clause
7+
*/
8+
9+
namespace VIPSoft\CodeCoverageCommon\Report;
10+
11+
use VIPSoft\TestCase;
12+
use VIPSoft\CodeCoverageCommon\Report\Factory;
13+
14+
/**
15+
* Clover report test
16+
*
17+
* @group Unit
18+
*/
19+
class CloverTest extends TestCase
20+
{
21+
public function testProcess()
22+
{
23+
$report = $this->getMockBuilder('PHP_CodeCoverage_Report_Node_File')
24+
->disableOriginalConstructor()
25+
->getMock();
26+
27+
$coverage = $this->getMock('PHP_CodeCoverage');
28+
$coverage->expects($this->once())
29+
->method('getReport')
30+
->will($this->returnValue($report));
31+
32+
$report = new Clover(array());
33+
$result = $report->process($coverage);
34+
35+
$this->assertTrue(strpos($result, '<?xml version="1.0" encoding="UTF-8"?>') === 0);
36+
}
37+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Crap4j Report
4+
*
5+
* @copyright 2013 Anthon Pang
6+
* @license BSD-2-Clause
7+
*/
8+
9+
namespace VIPSoft\CodeCoverageCommon\Report;
10+
11+
use VIPSoft\TestCase;
12+
use VIPSoft\CodeCoverageCommon\Report\Factory;
13+
14+
/**
15+
* Crap4j report test
16+
*
17+
* @group Unit
18+
*/
19+
class Crap4jTest extends TestCase
20+
{
21+
public function testProcess()
22+
{
23+
if ( ! class_exists('PHP_CodeCoverage_Report_Crap4j')) {
24+
$this->markTestSkipped();
25+
26+
return;
27+
}
28+
29+
$this->markTestIncomplete();
30+
}
31+
}

0 commit comments

Comments
 (0)