|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the doyo/code-coverage project. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Anthonius Munthi <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
declare(strict_types=1); |
|
13
|
|
|
|
|
14
|
|
|
namespace Spec\Doyo\Bridge\CodeCoverage\Report; |
|
15
|
|
|
|
|
16
|
|
|
use Doyo\Bridge\CodeCoverage\Console\ConsoleIO; |
|
17
|
|
|
use Doyo\Bridge\CodeCoverage\Driver\Dummy; |
|
18
|
|
|
use Doyo\Bridge\CodeCoverage\ProcessorInterface; |
|
19
|
|
|
use Doyo\Bridge\CodeCoverage\Report\AbstractReportProcessor; |
|
20
|
|
|
use Doyo\Bridge\CodeCoverage\Report\PHP; |
|
21
|
|
|
use Doyo\Bridge\CodeCoverage\Report\Text; |
|
22
|
|
|
use PhpSpec\ObjectBehavior; |
|
|
|
|
|
|
23
|
|
|
use Prophecy\Argument; |
|
|
|
|
|
|
24
|
|
|
use SebastianBergmann\CodeCoverage\CodeCoverage; |
|
|
|
|
|
|
25
|
|
|
use Webmozart\Assert\Assert; |
|
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
class TextSpec extends ObjectBehavior |
|
28
|
|
|
{ |
|
29
|
|
|
public function let( |
|
30
|
|
|
ProcessorInterface $processor |
|
31
|
|
|
) { |
|
32
|
|
|
$coverage = new CodeCoverage(new Dummy()); |
|
33
|
|
|
$processor->getCodeCoverage()->willReturn($coverage); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function it_is_initializable() |
|
37
|
|
|
{ |
|
38
|
|
|
$this->shouldHaveType(Text::class); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function it_should_be_a_report_processor() |
|
42
|
|
|
{ |
|
43
|
|
|
$this->shouldBeAnInstanceOf(AbstractReportProcessor::class); |
|
44
|
|
|
$this->getProcessorClass()->shouldReturn(\SebastianBergmann\CodeCoverage\Report\Text::class); |
|
|
|
|
|
|
45
|
|
|
$this->getOutputType()->shouldReturn(PHP::OUTPUT_CONSOLE); |
|
46
|
|
|
$this->getType()->shouldReturn('text'); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function it_should_produce_output_to_console( |
|
50
|
|
|
ProcessorInterface $processor, |
|
51
|
|
|
ConsoleIO $consoleIO |
|
52
|
|
|
) { |
|
53
|
|
|
$consoleIO->coverageInfo(Argument::containingString('Code Coverage Report:'))->shouldBeCalledOnce(); |
|
54
|
|
|
|
|
55
|
|
|
$this->process($processor, $consoleIO); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function it_should_produce_output_to_text( |
|
59
|
|
|
ProcessorInterface $processor, |
|
60
|
|
|
ConsoleIO $consoleIO |
|
61
|
|
|
) { |
|
62
|
|
|
$target = sys_get_temp_dir().'/doyo/report/coverage.txt'; |
|
63
|
|
|
$options['target'] = $target; |
|
|
|
|
|
|
64
|
|
|
|
|
65
|
|
|
$this->beConstructedWith($options); |
|
66
|
|
|
|
|
67
|
|
|
$this->process($processor, $consoleIO); |
|
68
|
|
|
Assert::directory(\dirname($target)); |
|
69
|
|
|
Assert::file($target); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths