16 $rootPath = realpath( __DIR__ .
'/..' );
17 $suitesPath = realpath( __DIR__ .
'/../suites/' );
18 $testClassRegex = implode(
'|', [
22 'ApiQueryContinueTestBase',
23 'MediaWikiLangTestCase',
24 'MediaWikiMediaTestCase',
26 'ResourceLoaderTestCase',
27 'PHPUnit_Framework_TestCase',
28 '\\?PHPUnit\\Framework\\TestCase',
31 'SpecialPageTestBase',
33 $testClassRegex =
"/^class .* extends ($testClassRegex)/m";
37 $results = array_filter(
39 function ( $filename )
use ( $testClassRegex, $suitesPath ) {
41 if ( strpos( $filename, $suitesPath ) === 0
42 || substr( $filename, -8 ) ===
'Test.php'
46 $contents = file_get_contents( $filename );
47 return preg_match( $testClassRegex, $contents );
50 $strip = strlen( $rootPath ) + 1;
51 foreach ( $results
as $k => $v ) {
52 $results[$k] = substr( $v, $strip );
57 "Unit test file in $rootPath must end with Test."