|
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
|
|
|
$this->iterator = $configuration->getTestSuiteConfiguration(); |
|
25
|
|
|
} else { |
|
26
|
|
|
if (class_exists('PHPUnit\TextUI\Configuration\TestSuiteMapper', true)) { |
|
27
|
|
|
// PHPUnit < 9.3 |
|
28
|
|
|
$testSuiteMapper = new \PHPUnit\TextUI\Configuration\TestSuiteMapper(); |
|
|
|
|
|
|
29
|
|
|
} elseif (class_exists('PHPUnit\TextUI\XmlConfiguration\TestSuiteMapper', true)) { |
|
30
|
|
|
// PHPUnit >= 9.3 & < 9.5 |
|
31
|
|
|
$testSuiteMapper = new \PHPUnit\TextUI\XmlConfiguration\TestSuiteMapper(); |
|
|
|
|
|
|
32
|
|
|
} elseif (class_exists('PHPUnit\TextUI\TestSuiteMapper', true)) { |
|
33
|
|
|
// PHPUnit >= 9.5 |
|
34
|
|
|
$testSuiteMapper = new \PHPUnit\TextUI\TestSuiteMapper(); |
|
35
|
|
|
} else { |
|
36
|
|
|
throw new \RuntimeException('Could not find PHPUnit TestSuiteMapper class'); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
$this->iterator = $testSuiteMapper->map($configuration->testSuite(), ''); |
|
|
|
|
|
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
$this->iteratorIterator = new \RecursiveIteratorIterator($this->iterator); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
#[\ReturnTypeWillChange] |
|
46
|
|
|
public function current() |
|
47
|
|
|
{ |
|
48
|
|
|
return $this->iteratorIterator->current(); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
#[\ReturnTypeWillChange] |
|
52
|
|
|
public function key() |
|
53
|
|
|
{ |
|
54
|
|
|
return $this->iteratorIterator->key(); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
#[\ReturnTypeWillChange] |
|
58
|
|
|
public function next() |
|
59
|
|
|
{ |
|
60
|
|
|
$this->iteratorIterator->next(); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
#[\ReturnTypeWillChange] |
|
64
|
|
|
public function rewind() |
|
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