<?php
-/**
- * @coversNothing
- */
class AutoLoaderStructureTest extends MediaWikiTestCase {
/**
* Assert that there were no classes loaded that are not registered with the AutoLoader.
// Check that the expected class name (based on the filename) is the
// same as the one we found.
// Strip directory prefix from front of filename, and .php extension
- $abbrFileName = substr( substr( $file, strlen( $dir ) ), 0, -4 );
+ $dirNameLength = strlen( realpath( $dir ) ) + 1; // +1 for the trailing slash
+ $fileBaseName = substr( $file, $dirNameLength );
+ $abbrFileName = substr( $fileBaseName, 0, -4 );
$expectedClassName = $prefix . str_replace( '/', '\\', $abbrFileName );
$this->assertSame(
// 'class Foo {}'
$class = $fileNamespace . $match['class'];
$classesInFile[$class] = true;
+ } elseif ( !empty( $match['original'] ) ) {
+ // 'class_alias( "Foo", "Bar" );'
+ $aliasesInFile[$match['alias']] = $match['original'];
} else {
- if ( !empty( $match['original'] ) ) {
- // 'class_alias( "Foo", "Bar" );'
- $aliasesInFile[$match['alias']] = $match['original'];
- } else {
- // 'class_alias( Foo::class, "Bar" );'
- $aliasesInFile[$match['aliasString']] = $fileNamespace . $match['originalStatic'];
- }
+ // 'class_alias( Foo::class, "Bar" );'
+ $aliasesInFile[$match['aliasString']] = $fileNamespace . $match['originalStatic'];
}
}