1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace OckCyp\CoversValidator\Model; |
4
|
|
|
|
5
|
|
|
use PHPUnit\Util\Configuration as PHPUnit8Configuration; |
|
|
|
|
6
|
|
|
|
7
|
|
|
class TestCollection implements \Iterator |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* @var \Iterator |
11
|
|
|
*/ |
12
|
|
|
private $iterator; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @var \Iterator |
16
|
|
|
*/ |
17
|
|
|
private $iteratorIterator; |
18
|
|
|
|
19
|
|
|
public function __construct(ConfigurationHolder $configurationHolder) |
20
|
|
|
{ |
21
|
|
|
$configuration = $configurationHolder->getConfiguration(); |
22
|
|
|
|
23
|
|
|
if ($configuration instanceof PHPUnit8Configuration) { |
24
|
|
|
// @codeCoverageIgnoreStart |
25
|
|
|
$this->iterator = $configuration->getTestSuiteConfiguration(); |
26
|
|
|
} else { |
27
|
|
|
if (class_exists('PHPUnit\TextUI\Configuration\TestSuiteMapper', true)) { |
28
|
|
|
// PHPUnit < 9.3 |
29
|
|
|
$testSuiteMapper = new \PHPUnit\TextUI\Configuration\TestSuiteMapper(); |
|
|
|
|
30
|
|
|
} elseif (class_exists('PHPUnit\TextUI\XmlConfiguration\TestSuiteMapper', true)) { |
31
|
|
|
// PHPUnit >= 9.3 & < 9.5 |
32
|
|
|
$testSuiteMapper = new \PHPUnit\TextUI\XmlConfiguration\TestSuiteMapper(); |
|
|
|
|
33
|
|
|
// @codeCoverageIgnoreEnd |
34
|
|
|
} elseif (class_exists('PHPUnit\TextUI\TestSuiteMapper', true)) { |
35
|
|
|
// PHPUnit >= 9.5 |
36
|
|
|
$testSuiteMapper = new \PHPUnit\TextUI\TestSuiteMapper(); |
37
|
|
|
} else { |
38
|
|
|
throw new \RuntimeException('Could not find PHPUnit TestSuiteMapper class'); // @codeCoverageIgnore |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
$this->iterator = $testSuiteMapper->map($configuration->testSuite(), ''); |
|
|
|
|
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
$this->iteratorIterator = new \RecursiveIteratorIterator($this->iterator); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
#[\ReturnTypeWillChange] |
48
|
|
|
public function current() |
49
|
|
|
{ |
50
|
|
|
return $this->iteratorIterator->current(); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
#[\ReturnTypeWillChange] |
54
|
|
|
public function key() |
55
|
|
|
{ |
56
|
|
|
return $this->iteratorIterator->key(); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function next(): void |
60
|
|
|
{ |
61
|
|
|
$this->iteratorIterator->next(); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function rewind(): void |
65
|
|
|
{ |
66
|
|
|
$this->iteratorIterator->rewind(); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function valid(): bool |
70
|
|
|
{ |
71
|
|
|
return $this->iteratorIterator->valid(); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function isEmpty(): bool |
75
|
|
|
{ |
76
|
|
|
return !\count($this->iterator); |
|
|
|
|
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|
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