jenkins-bot has submitted this change and it was merged.

Change subject: Handle phpunit being autoloaded from checkLess.php
......................................................................


Handle phpunit being autoloaded from checkLess.php

When phpunit is available via the autoloader, rather than directly in the
include path, checkLess was erroring out.  Additionally
RequestContext::resetMain() was outputting warnings due to MW_PHPUNIT_TEST
not being defined.

Change-Id: I28921c018daa59b2da78ffb5312690d1ce8fbb0a
---
M maintenance/checkLess.php
1 file changed, 11 insertions(+), 1 deletion(-)

Approvals:
  Mattflaschen: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/maintenance/checkLess.php b/maintenance/checkLess.php
index b97e1b0..2f533cf 100644
--- a/maintenance/checkLess.php
+++ b/maintenance/checkLess.php
@@ -22,7 +22,6 @@
  */
 
 require_once __DIR__ . '/Maintenance.php';
-require_once 'PHPUnit/Autoload.php';
 
 /**
  * @ingroup Maintenance
@@ -43,6 +42,17 @@
                // require it here.
                require_once __DIR__ . '/../tests/TestsAutoLoader.php';
 
+               // If phpunit isn't available by autoloader try pulling it in
+               if ( !class_exists( 'PHPUnit_Framework_TestCase' ) ) {
+                       require_once 'PHPUnit/Autoload.php';
+               }
+
+               // RequestContext::resetMain() will print warnings unless this
+               // is defined.
+               if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
+                       define( 'MW_PHPUNIT_TEST', true );
+               }
+
                $textUICommand = new PHPUnit_TextUI_Command();
                $argv = array(
                        "$IP/tests/phpunit/phpunit.php",

-- 
To view, visit https://gerrit.wikimedia.org/r/178231
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I28921c018daa59b2da78ffb5312690d1ce8fbb0a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: MatthiasM <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Phuedx <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to