Merge "Fix TimestampTest broken by 7e3386d4"
[lhc/web/wiklou.git] / tests / phpunit / phpunit.php
index 2a0298a..b425d86 100755 (executable)
@@ -8,14 +8,11 @@
 
 /* Configuration */
 
-// Evaluate the include path relative to this file
-$IP = dirname( dirname( __DIR__ ) );
-
 // Set a flag which can be used to detect when other scripts have been entered through this entry point or not
 define( 'MW_PHPUNIT_TEST', true );
 
 // Start up MediaWiki in command-line mode
-require_once( "$IP/maintenance/Maintenance.php" );
+require_once( dirname( dirname( __DIR__ ) ) . "/maintenance/Maintenance.php" );
 
 class PHPUnitMaintClass extends Maintenance {
 
@@ -50,6 +47,15 @@ class PHPUnitMaintClass extends Maintenance {
                $wgLocaltimezone = 'UTC';
 
                $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null';
+
+               // Bug 44192 Do not attempt to send a real e-mail
+               Hooks::clear( 'AlternateUserMailer' );
+               Hooks::register(
+                       'AlternateUserMailer',
+                       function () {
+                               return false;
+                       }
+               );
        }
 
        public function execute() {
@@ -83,7 +89,6 @@ class PHPUnitMaintClass extends Maintenance {
                        unset( $_SERVER['argv'][$key] ); // the option
                        unset( $_SERVER['argv'][$key + 1] ); // its value
                        $_SERVER['argv'] = array_values( $_SERVER['argv'] );
-
                }
        }