Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
PhpUnitTestFileScannerFilter | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
accept | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
12 |
1 | <?php |
2 | |
3 | declare( strict_types = 1 ); |
4 | |
5 | namespace MediaWiki\Composer\PhpUnitSplitter; |
6 | |
7 | use RecursiveFilterIterator; |
8 | |
9 | /** |
10 | * @license GPL-2.0-or-later |
11 | */ |
12 | class PhpUnitTestFileScannerFilter extends RecursiveFilterIterator { |
13 | |
14 | /** |
15 | * @var string[] list of folders and files to skip. We want to avoid |
16 | * loading PHP files from the vendor folder since that's |
17 | * not our code. ParserIntegrationTest is a complex suite |
18 | * that we can't handle in the usual way, so we will add |
19 | * that to a suite on its own, manually, as required. |
20 | * Likewise `LuaSandbox\\SandboxTest` from the Scribunto |
21 | * extension is a dynamic suite that generates classes |
22 | * during `--list-tests-xml` which we can't run on their |
23 | * own. We skip it in the scan and add it manually back |
24 | * later. |
25 | * `LuaEngineTestSkip` is an empty test case |
26 | * generated by Scribunto's dynamic test suite when a |
27 | * particular Lua engine isn't available. Since this is |
28 | * just an empty test suite with a skipped test, we can |
29 | * filter this from the list of test classes. |
30 | * @see T345481 |
31 | */ |
32 | private const IGNORE = [ |
33 | "vendor", |
34 | "ParserIntegrationTest.php", |
35 | "SandboxTest.php", |
36 | "LuaEngineTestSkip.php" |
37 | ]; |
38 | |
39 | public function accept(): bool { |
40 | $filename = $this->current()->getFilename(); |
41 | if ( $filename[0] === '.' ) { |
42 | return false; |
43 | } |
44 | if ( in_array( $filename, self::IGNORE ) ) { |
45 | return false; |
46 | } |
47 | return true; |
48 | } |
49 | |
50 | } |