2 class AutoLoaderTest
extends MediaWikiTestCase
{
4 public function testAutoLoadConfig() {
5 $results = self
::checkAutoLoadConf();
13 protected static function checkAutoLoadConf() {
14 global $wgAutoloadLocalClasses, $wgAutoloadClasses, $IP;
15 $supportsParsekit = function_exists( 'parsekit_compile_file' );
17 // wgAutoloadLocalClasses has precedence, just like in includes/AutoLoader.php
18 $expected = $wgAutoloadLocalClasses +
$wgAutoloadClasses;
21 $files = array_unique( $expected );
23 foreach ( $files as $file ) {
24 // Only prefix $IP if it doesn't have it already.
25 // Generally local classes don't have it, and those from extensions and test suites do.
26 if ( substr( $file, 0, 1 ) != '/' && substr( $file, 1, 1 ) != ':' ) {
27 $filePath = "$IP/$file";
31 if ( $supportsParsekit ) {
32 $parseInfo = parsekit_compile_file( "$filePath" );
33 $classes = array_keys( $parseInfo['class_table'] );
35 $contents = file_get_contents( "$filePath" );
37 preg_match_all( '/\n\s*(?:final)?\s*(?:abstract)?\s*(?:class|interface)\s+([a-zA-Z0-9_]+)/', $contents, $m, PREG_PATTERN_ORDER
);
40 foreach ( $classes as $class ) {
41 $actual[$class] = $file;
46 'expected' => $expected,