Use pathinfo() in AutoLoaderStructureTest::testPSR4Completeness
When setting AutoloadNamespaces to './' in extension.json, the test AutoLoaderStructureTest::testPSR4Completeness would fail. The directory path is not made canonical while the file is, which causes the substr() call being used to strip too many characters. For example: $dir : /mediawiki/extensions/Wikidata.org/./ $file: /mediawiki/extensions/Wikidata.org/Hooks.php $abbrFileName = substr( substr( $file, strlen( $dir ) ), 0, -4 ); >>> oks Use pathinfo() to parse the filename. Yields 'Hooks' as expected. Bug: T198077 Change-Id: Ia8a11d87788b32ddb426a16a61b410b05ff5f15e
This commit is contained in:
parent
f25d33057d
commit
634c2ec2af
1 changed files with 1 additions and 1 deletions
|
|
@ -46,7 +46,7 @@ class AutoLoaderStructureTest extends MediaWikiTestCase {
|
|||
// 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 );
|
||||
$abbrFileName = pathinfo( $file, PATHINFO_FILENAME );
|
||||
$expectedClassName = $prefix . str_replace( '/', '\\', $abbrFileName );
|
||||
|
||||
$this->assertSame(
|
||||
|
|
|
|||
Loading…
Reference in a new issue