From: mainframe98 Date: Sun, 1 Sep 2019 15:44:14 +0000 (+0200) Subject: Permit case independent unit test directories X-Git-Tag: 1.34.0-rc.0~430^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=commitdiff_plain;h=4e330b4498073b5f9f1189c8b888020659cb538c;p=lhc%2Fweb%2Fwiklou.git Permit case independent unit test directories 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 --- diff --git a/tests/phpunit/MediaWikiUnitTestCase.php b/tests/phpunit/MediaWikiUnitTestCase.php index edd8195991..bb018aaf14 100644 --- a/tests/phpunit/MediaWikiUnitTestCase.php +++ b/tests/phpunit/MediaWikiUnitTestCase.php @@ -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;