diff options
author | Umherirrender <umherirrender_de.wp@web.de> | 2020-10-31 02:04:49 +0100 |
---|---|---|
committer | Jforrester <jforrester@wikimedia.org> | 2020-12-13 17:16:53 +0000 |
commit | 339f86629f6d7e94da9af2384997a9c515cfb4fa (patch) | |
tree | 0af954e2b47682c302433a430d99d249e338115f /tests/phpunit/structure/AutoLoaderStructureTest.php | |
parent | dbb1a9ef64604cedfd85b7c04a6b4699cad5c3c2 (diff) | |
download | mediawikicore-339f86629f6d7e94da9af2384997a9c515cfb4fa.tar.gz mediawikicore-339f86629f6d7e94da9af2384997a9c515cfb4fa.zip |
AutoLoaderStructureTest: Re-write slashes so test passes on Windows
A difference between UNIX and Windows is the dir separator,
which makes this test failing, because the file name does not match to
filter out the psr4 loaded classes to just keep the alias, which must be
part of the autoloader class list.
1) AutoLoaderStructureTest::testAutoLoadConfig
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
'ParserTestFileSuite' => '[...]...te.php'
'ParserTestTopLevelSuite' => '[...]...te.php'
'SuiteEventsTrait' => '[...]...it.php'
+ 'MediaWiki\Block\DatabaseBlock' => '[...]...ck.php'
+ 'MediaWiki\SpecialPage\SpecialPageFactory' => '[...]...ry.php'
+ 'MediaWiki\Revision\IncompleteRevisionException' =>
'[...]...on.php'
+ 'MediaWiki\Revision\MutableRevisionRecord' => '[...]...rd.php'
+ 'MediaWiki\Revision\MutableRevisionSlots' => '[...]...ts.php'
+ 'MediaWiki\Revision\RevisionAccessException' => '[...]...on.php'
+ 'MediaWiki\Revision\RevisionArchiveRecord' => '[...]...rd.php'
+ 'MediaWiki\Revision\RevisionFactory' => '[...]...ry.php'
+ 'MediaWiki\Revision\RevisionLookup' => '[...]...up.php'
+ 'MediaWiki\Revision\RevisionRecord' => '[...]...rd.php'
+ 'MediaWiki\Revision\RevisionSlots' => '[...]...ts.php'
+ 'MediaWiki\Revision\RevisionStore' => '[...]...re.php'
+ 'MediaWiki\Revision\RevisionStoreRecord' => '[...]...rd.php'
+ 'MediaWiki\Revision\SlotRecord' => '[...]...rd.php'
+ 'MediaWiki\Revision\SuppressedDataException' => '[...]...on.php'
)
Change-Id: I1485cc7309c20d131f398473367d281a3ce78a25
Diffstat (limited to 'tests/phpunit/structure/AutoLoaderStructureTest.php')
-rw-r--r-- | tests/phpunit/structure/AutoLoaderStructureTest.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/phpunit/structure/AutoLoaderStructureTest.php b/tests/phpunit/structure/AutoLoaderStructureTest.php index 045a990f85f4..87c93c58b6c3 100644 --- a/tests/phpunit/structure/AutoLoaderStructureTest.php +++ b/tests/phpunit/structure/AutoLoaderStructureTest.php @@ -71,6 +71,10 @@ class AutoLoaderStructureTest extends MediaWikiIntegrationTestCase { return str_replace( '\\\\', '\\', $str ); } + private static function fixSlashes( $str ) { + return str_replace( '\\', '/', $str ); + } + protected static function checkAutoLoadConf() { global $wgAutoloadLocalClasses, $wgAutoloadClasses, $IP; @@ -80,16 +84,16 @@ class AutoLoaderStructureTest extends MediaWikiIntegrationTestCase { $psr4Namespaces = []; foreach ( AutoLoader::getAutoloadNamespaces() as $ns => $path ) { - $psr4Namespaces[rtrim( $ns, '\\' ) . '\\'] = rtrim( $path, '/' ); + $psr4Namespaces[rtrim( $ns, '\\' ) . '\\'] = self::fixSlashes( rtrim( $path, '/' ) ); } foreach ( $expected as $class => $file ) { // Only prefix $IP if it doesn't have it already. // Generally local classes don't have it, and those from extensions and test suites do. if ( substr( $file, 0, 1 ) != '/' && substr( $file, 1, 1 ) != ':' ) { - $filePath = "$IP/$file"; + $filePath = self::fixSlashes( "$IP/$file" ); } else { - $filePath = $file; + $filePath = self::fixSlashes( $file ); } if ( !file_exists( $filePath ) ) { |