-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathPhp.php
More file actions
67 lines (57 loc) · 1.46 KB
/
Php.php
File metadata and controls
67 lines (57 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
* Code Coverage PHP Report
*
* @copyright 2013 Anthon Pang
*
* @license BSD-3-Clause
*/
namespace LeanPHP\Behat\CodeCoverage\Common\Report;
use LeanPHP\Behat\CodeCoverage\Common\ReportInterface;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Report\PHP as PHPReport;
/**
* PHP report
*
* @author Anthon Pang <apang@softwaredevelopment.ca>
*/
class Php implements ReportInterface
{
/**
* @var \SebastianBergmann\CodeCoverage\Report\Clover
*/
private $report;
/**
* @var array
*/
private $options;
/**
* {@inheritdoc}
*/
public function __construct(array $options)
{
if (! isset($options['target'])) {
$options['target'] = null;
}
$this->report = new PHPReport();
$this->options = $options;
}
/**
* {@inheritdoc}
*/
public function process(CodeCoverage $coverage)
{
if (getenv('ENV_TEST_INC_NUMBER')) {
$slot = getenv('ENV_TEST_INC_NUMBER');
} else {
$slot = '1';
}
$suite = getenv('BEHAT_PHING_TARGET') ? getenv('BEHAT_PHING_TARGET') : 'default';
$this->options['target'] = str_replace('{n}', $slot, $this->options['target']);
$this->options['target'] = str_replace('{suite}', $suite, $this->options['target']);
return $this->report->process(
$coverage,
$this->options['target']
);
}
}