Merge "Don't modify $wgHooks on language object construction"
[lhc/web/wiklou.git] / tests / phpunit / phpunit.php
index f080593..81dc412 100755 (executable)
@@ -74,6 +74,7 @@ class PHPUnitMaintClass extends Maintenance {
                global $wgLanguageConverterCacheType, $wgUseDatabaseMessages;
                global $wgLocaltimezone, $wgLocalisationCacheConf;
                global $wgDevelopmentWarnings;
+               global $wgSessionProviders;
                global $wgJobTypeConf;
 
                // Inject test autoloader
@@ -109,6 +110,19 @@ class PHPUnitMaintClass extends Maintenance {
 
                $wgLocalisationCacheConf['storeClass'] = 'LCStoreNull';
 
+               // Generic MediaWiki\Session\SessionManager configuration for tests
+               // We use CookieSessionProvider because things might be expecting
+               // cookies to show up in a FauxRequest somewhere.
+               $wgSessionProviders = array(
+                       array(
+                               'class' => 'MediaWiki\\Session\\CookieSessionProvider',
+                               'args' => array( array(
+                                       'priority' => 30,
+                                       'callUserSetCookiesHook' => true,
+                               ) ),
+                       ),
+               );
+
                // Bug 44192 Do not attempt to send a real e-mail
                Hooks::clear( 'AlternateUserMailer' );
                Hooks::register(
@@ -240,14 +254,6 @@ class PHPUnitMaintClass extends Maintenance {
 $maintClass = 'PHPUnitMaintClass';
 require RUN_MAINTENANCE_IF_MAIN;
 
-// Prevent segfault when we have lots of unit tests (bug 62623)
-if ( version_compare( PHP_VERSION, '5.4.0', '<' ) ) {
-       register_shutdown_function( function () {
-               gc_collect_cycles();
-               gc_disable();
-       } );
-}
-
 $ok = false;
 
 if ( class_exists( 'PHPUnit_TextUI_Command' ) ) {
@@ -288,4 +294,8 @@ if ( $puVersion !== '@package_version@' && version_compare( $puVersion, '3.7.0',
        exit( 1 );
 }
 
+echo defined( 'HHVM_VERSION' ) ?
+       'Using HHVM ' . HHVM_VERSION . ' (' . PHP_VERSION . ")\n" :
+       'Using PHP ' . PHP_VERSION . "\n";
+
 PHPUnit_TextUI_Command::main();