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; |
15
|
|
|
|
16
|
|
|
use Doyo\Bridge\CodeCoverage\Driver\Dummy; |
17
|
|
|
use Doyo\Bridge\CodeCoverage\Processor; |
18
|
|
|
use Doyo\Bridge\CodeCoverage\TestCase; |
19
|
|
|
use PhpSpec\ObjectBehavior; |
|
|
|
|
20
|
|
|
use SebastianBergmann\CodeCoverage\CodeCoverage; |
|
|
|
|
21
|
|
|
use SebastianBergmann\CodeCoverage\Driver\Driver; |
|
|
|
|
22
|
|
|
use SebastianBergmann\CodeCoverage\Filter; |
|
|
|
|
23
|
|
|
|
24
|
|
|
class ProcessorSpec extends ObjectBehavior |
25
|
|
|
{ |
26
|
|
|
public function let( |
27
|
|
|
Driver $driver |
28
|
|
|
) { |
29
|
|
|
$filter = new Filter(); |
30
|
|
|
$filter->addFileToWhitelist(__FILE__); |
31
|
|
|
$this->beConstructedWith($driver, $filter); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function it_is_initializable() |
35
|
|
|
{ |
36
|
|
|
$this->shouldHaveType(Processor::class); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function its_code_coverage_should_be_mutable( |
40
|
|
|
Dummy $driver |
41
|
|
|
) { |
42
|
|
|
$codeCoverage = new CodeCoverage($driver->getWrappedObject()); |
43
|
|
|
$this->getCodeCoverage()->shouldHaveType(CodeCoverage::class); |
44
|
|
|
$this->setCodeCoverage($codeCoverage); |
45
|
|
|
$this->getCodeCoverage()->shouldReturn($codeCoverage); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function its_currentTestCase_should_be_mutable( |
49
|
|
|
TestCase $testCase |
50
|
|
|
) { |
51
|
|
|
$this->getCurrentTestCase()->shouldBeNull(); |
52
|
|
|
$this->setCurrentTestCase($testCase); |
53
|
|
|
$this->getCurrentTestCase()->shouldReturn($testCase); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function its_stop_should_be_callable( |
57
|
|
|
Driver $driver, |
58
|
|
|
TestCase $testCase |
59
|
|
|
) { |
60
|
|
|
$testCase->getName()->shouldBeCalled()->willReturn('some-id'); |
61
|
|
|
$driver->start(true)->shouldBeCalled(); |
62
|
|
|
$driver->stop()->shouldBeCalled()->willReturn([]); |
63
|
|
|
$this->start($testCase); |
64
|
|
|
$this->stop(); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function it_should_patch_coverage_data_when_test_completed( |
68
|
|
|
TestCase $testCase |
69
|
|
|
) { |
70
|
|
|
$testCase->getName()->willReturn('some-test'); |
71
|
|
|
$testCase->getResult()->willReturn(TestCase::RESULT_PASSED); |
72
|
|
|
|
73
|
|
|
$this->addTestCase($testCase); |
74
|
|
|
$this->complete(); |
75
|
|
|
|
76
|
|
|
$coverage = $this->getCodeCoverage(); |
77
|
|
|
$coverage->getTests()->shouldHaveKey('some-test'); |
78
|
|
|
$coverage->getTests()->shouldHaveKeyWithValue('some-test', ['status' => TestCase::RESULT_PASSED]); |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|
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