Permit case independent unit test directories
authormainframe98 <k.s.werf@hotmail.com>
Sun, 1 Sep 2019 15:44:14 +0000 (17:44 +0200)
committermainframe98 <k.s.werf@hotmail.com>
Sun, 1 Sep 2019 15:44:14 +0000 (17:44 +0200)
If unit tests are namespaced under Tests/Unit/, with tests/phpunit being
the PSR4 root Tests/, then the the unit test directory cannot be named unit/.
The autoloader will not be able to find the files in that namespace, as
it will be looking for the directory Unit/, not unit/.

Change-Id: I8cf6cd31f22decb061650def9e1e5d8893dfa73f

tests/phpunit/MediaWikiUnitTestCase.php

index edd8195..bb018aa 100644 (file)
@@ -40,7 +40,7 @@ abstract class MediaWikiUnitTestCase extends TestCase {
                parent::setUp();
                $reflection = new ReflectionClass( $this );
                $dirSeparator = DIRECTORY_SEPARATOR;
-               if ( strpos( $reflection->getFilename(), "${dirSeparator}unit${dirSeparator}" ) === false ) {
+               if ( stripos( $reflection->getFilename(), "${dirSeparator}unit${dirSeparator}" ) === false ) {
                        $this->fail( 'This unit test needs to be in "tests/phpunit/unit"!' );
                }
                $this->unitGlobals = $GLOBALS;