MediaWiki
master
PhpUnitTestListProcessor.php
Go to the documentation of this file.
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace
MediaWiki\Composer\PhpUnitSplitter
;
6
7
use SimpleXMLElement;
8
12
class
PhpUnitTestListProcessor
{
13
14
private
SimpleXMLElement $xml;
15
16
public
function
__construct
(
string
$testListFile ) {
17
$this->xml =
new
SimpleXMLElement( file_get_contents( $testListFile ) );
18
}
19
25
public
function
getTestClasses
(): array {
26
if
( !property_exists( $this->xml,
"testCaseClass"
) ) {
27
return
[];
28
}
29
return
array_map(
30
fn ( $element ) => self::extractNamespace( (
string
)$element->attributes()[
"name"
] ),
31
iterator_to_array( $this->xml->testCaseClass,
false
)
32
);
33
}
34
35
private
static
function
extractNamespace(
string
$qualifiedClassName ): TestDescriptor {
36
$parts = explode(
'\\'
, $qualifiedClassName );
37
$className = array_pop( $parts );
38
return
new
TestDescriptor( $className, $parts );
39
}
40
}
if
if(!defined('MW_SETUP_CALLBACK'))
Definition
WebStart.php:81
MediaWiki\Composer\PhpUnitSplitter\PhpUnitTestListProcessor
Definition
PhpUnitTestListProcessor.php:12
MediaWiki\Composer\PhpUnitSplitter\PhpUnitTestListProcessor\getTestClasses
getTestClasses()
Definition
PhpUnitTestListProcessor.php:25
MediaWiki\Composer\PhpUnitSplitter\PhpUnitTestListProcessor\__construct
__construct(string $testListFile)
Definition
PhpUnitTestListProcessor.php:16
MediaWiki\Composer\PhpUnitSplitter
Definition
MissingNamespaceMatchForTestException.php:5
includes
composer
PhpUnitSplitter
PhpUnitTestListProcessor.php
Generated on Sat Jul 27 2024 11:22:31 for MediaWiki by
1.10.0