The file paths we inspect are always normalized (File_Iterator_Facade
applies realpath()), but the directory we compare against may not be,
depending on how wfLoadExtension() was called. Normalize the directory
before we remove the directory prefix from each file, so that we don’t
end up stripping away the wrong parts of the path.
Change-Id: Ib272fb892c18d989f8d439ed50c6a5a8fd542cc9
// 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(