From d94906eaa20ccb0d36277d1172dba8f512c6497f Mon Sep 17 00:00:00 2001 From: RazeSoldier Date: Thu, 18 Jul 2019 01:52:18 +0800 Subject: [PATCH] MediaWikiUnitTestCase: Use DIRECTORY_SEPARATOR instead of `/` `strpos( $reflection->getFilename(), '/unit/' )` will always return FALSE under Windows Change-Id: Ib13d32858e238b9a18094f829939f6bba08366ab --- tests/phpunit/MediaWikiUnitTestCase.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/MediaWikiUnitTestCase.php b/tests/phpunit/MediaWikiUnitTestCase.php index 43a333cb88..5f7746b3e6 100644 --- a/tests/phpunit/MediaWikiUnitTestCase.php +++ b/tests/phpunit/MediaWikiUnitTestCase.php @@ -36,7 +36,8 @@ abstract class MediaWikiUnitTestCase extends TestCase { protected function setUp() { parent::setUp(); $reflection = new ReflectionClass( $this ); - if ( strpos( $reflection->getFilename(), '/unit/' ) === false ) { + $dirSeparator = DIRECTORY_SEPARATOR; + if ( strpos( $reflection->getFilename(), "${dirSeparator}unit${dirSeparator}" ) === false ) { $this->fail( 'This unit test needs to be in "tests/phpunit/unit" !' ); } $this->unitGlobals = $GLOBALS; -- 2.20.1