Use pathinfo() in AutoLoaderStructureTest::testPSR4Completeness
authorAntoine Musso <hashar@free.fr>
Mon, 25 Jun 2018 11:32:30 +0000 (13:32 +0200)
committerLegoktm <legoktm@member.fsf.org>
Mon, 25 Jun 2018 11:47:52 +0000 (11:47 +0000)
commit634c2ec2afd93827e5aaf571396eb76d35948188
treecd512568fa2380a94cd863f6bb7bd0abaea94ab1
parentf25d33057d248af1782be63714add0d2e9a421d2
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
tests/phpunit/structure/AutoLoaderStructureTest.php