/** * finalSetup() since we need MWException */ public function finalSetup() { parent::finalSetup(); $this->regex = $this->getOption('regex') ?: $this->getOption('iregex'); if ($this->regex) { $this->regex = '/' . $this->regex . '/'; if ($this->hasOption('iregex')) { $this->regex .= 'i'; # case insensitive regex } } if ($this->hasOption('settings')) { $this->settings_list = explode(' ', $this->getOption('settings')); # Values validation foreach ($this->settings_list as $name) { if (!preg_match('/^wg[A-Z]/', $name)) { throw new MWException("Variable '{$name}' does start with 'wg'."); } elseif (!isset($GLOBALS[$name])) { throw new MWException("Variable '{$name}' is not set."); } elseif (!$this->isAllowedVariable($GLOBALS[$name])) { throw new MWException("Variable '{$name}' includes non-array, non-scalar, items."); } } } }
public function finalSetup() { parent::finalSetup(); global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgMainWANCache; global $wgLanguageConverterCacheType, $wgUseDatabaseMessages; global $wgLocaltimezone, $wgLocalisationCacheConf; global $wgDevelopmentWarnings; // Inject test autoloader require_once __DIR__ . '/../TestsAutoLoader.php'; // wfWarn should cause tests to fail $wgDevelopmentWarnings = true; $wgMainCacheType = CACHE_NONE; $wgMainWANCache = CACHE_NONE; $wgMessageCacheType = CACHE_NONE; $wgParserCacheType = CACHE_NONE; $wgLanguageConverterCacheType = CACHE_NONE; $wgUseDatabaseMessages = false; # Set for future resets // Assume UTC for testing purposes $wgLocaltimezone = 'UTC'; $wgLocalisationCacheConf['storeClass'] = 'LCStoreNull'; // Bug 44192 Do not attempt to send a real e-mail Hooks::clear('AlternateUserMailer'); Hooks::register('AlternateUserMailer', function () { return false; }); // xdebug's default of 100 is too low for MediaWiki ini_set('xdebug.max_nesting_level', 1000); }
public function finalSetup() { parent::finalSetup(); global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgMainWANCache; global $wgLanguageConverterCacheType, $wgUseDatabaseMessages; global $wgLocaltimezone, $wgLocalisationCacheConf; global $wgDevelopmentWarnings; // Inject test autoloader require_once __DIR__ . '/../TestsAutoLoader.php'; // wfWarn should cause tests to fail $wgDevelopmentWarnings = true; // Make sure all caches and stashes are either disabled or use // in-process cache only to prevent tests from using any preconfigured // cache meant for the local wiki from outside the test run. // See also MediaWikiTestCase::run() which mocks CACHE_DB and APC. // Disabled in DefaultSettings, override local settings $wgMainWANCache = $wgMainCacheType = CACHE_NONE; // Uses CACHE_ANYTHING in DefaultSettings, use hash instead of db $wgMessageCacheType = $wgParserCacheType = $wgSessionCacheType = $wgLanguageConverterCacheType = 'hash'; // Uses db-replicated in DefaultSettings $wgMainStash = 'hash'; $wgUseDatabaseMessages = false; # Set for future resets // Assume UTC for testing purposes $wgLocaltimezone = 'UTC'; $wgLocalisationCacheConf['storeClass'] = 'LCStoreNull'; // Bug 44192 Do not attempt to send a real e-mail Hooks::clear('AlternateUserMailer'); Hooks::register('AlternateUserMailer', function () { return false; }); // xdebug's default of 100 is too low for MediaWiki ini_set('xdebug.max_nesting_level', 1000); }
public function finalSetup() { parent::finalSetup(); // Inject test autoloader self::requireTestsAutoloader(); TestSetup::applyInitialConfig(); }
public function finalSetup() { global $wgDebugToolbar; // Debug toolbar makes content uncacheable so we disable it. // Has to be done before Setup.php initialize MWDebug $wgDebugToolbar = false; parent::finalSetup(); }
public function finalSetup() { # This script needs to be run to build the inital l10n cache. But if # $wgLanguageCode is not 'en', it won't be able to run because there is # no l10n cache. Break the cycle by forcing $wgLanguageCode = 'en'. global $wgLanguageCode; $wgLanguageCode = 'en'; parent::finalSetup(); }
public function finalSetup() { parent::finalSetup(); if ($this->getDbType() == Maintenance::DB_NONE) { global $wgUseDatabaseMessages, $wgLocalisationCacheConf, $wgHooks; $wgUseDatabaseMessages = false; $wgLocalisationCacheConf['storeClass'] = 'LCStoreNull'; $wgHooks['InterwikiLoadPrefix'][] = 'DumpIterator::disableInterwikis'; } }
public function finalSetup() { parent::finalSetup(); global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgMainWANCache; global $wgMainStash; global $wgLanguageConverterCacheType, $wgUseDatabaseMessages; global $wgLocaltimezone, $wgLocalisationCacheConf; global $wgDevelopmentWarnings; global $wgSessionProviders; global $wgJobTypeConf; global $wgAuthManagerConfig, $wgAuth, $wgDisableAuthManager; // Inject test autoloader require_once __DIR__ . '/../TestsAutoLoader.php'; // wfWarn should cause tests to fail $wgDevelopmentWarnings = true; // Make sure all caches and stashes are either disabled or use // in-process cache only to prevent tests from using any preconfigured // cache meant for the local wiki from outside the test run. // See also MediaWikiTestCase::run() which mocks CACHE_DB and APC. // Disabled in DefaultSettings, override local settings $wgMainWANCache = $wgMainCacheType = CACHE_NONE; // Uses CACHE_ANYTHING in DefaultSettings, use hash instead of db $wgMessageCacheType = $wgParserCacheType = $wgSessionCacheType = $wgLanguageConverterCacheType = 'hash'; // Uses db-replicated in DefaultSettings $wgMainStash = 'hash'; // Use memory job queue $wgJobTypeConf = ['default' => ['class' => 'JobQueueMemory', 'order' => 'fifo']]; $wgUseDatabaseMessages = false; # Set for future resets // Assume UTC for testing purposes $wgLocaltimezone = 'UTC'; $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 = [['class' => MediaWiki\Session\CookieSessionProvider::class, 'args' => [['priority' => 30, 'callUserSetCookiesHook' => true]]]]; // Generic AuthManager configuration for testing $wgAuthManagerConfig = ['preauth' => [], 'primaryauth' => [['class' => MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider::class, 'args' => [['authoritative' => false]]], ['class' => MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider::class, 'args' => [['authoritative' => true]]]], 'secondaryauth' => []]; $wgAuth = $wgDisableAuthManager ? new AuthPlugin() : new MediaWiki\Auth\AuthManagerAuthPlugin(); // Bug 44192 Do not attempt to send a real e-mail Hooks::clear('AlternateUserMailer'); Hooks::register('AlternateUserMailer', function () { return false; }); // xdebug's default of 100 is too low for MediaWiki ini_set('xdebug.max_nesting_level', 1000); // Bug T116683 serialize_precision of 100 // may break testing against floating point values // treated with PHP's serialize() ini_set('serialize_precision', 17); // TODO: we should call MediaWikiTestCase::prepareServices( new GlobalVarConfig() ) here. // But PHPUnit may not be loaded yet, so we have to wait until just // before PHPUnit_TextUI_Command::main() is executed at the end of this file. }
public function finalSetup() { parent::finalSetup(); global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgUseDatabaseMessages; global $wgLocaltimezone, $wgLocalisationCacheConf; $wgMainCacheType = CACHE_NONE; $wgMessageCacheType = CACHE_NONE; $wgParserCacheType = CACHE_NONE; $wgUseDatabaseMessages = false; # Set for future resets // Assume UTC for testing purposes $wgLocaltimezone = 'UTC'; $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null'; }
public function finalSetup() { global $wgDebugToolbar, $wgUseFileCache, $wgReadOnly; $this->enabled = $wgUseFileCache; // Script will handle capturing output and saving it itself $wgUseFileCache = false; // Debug toolbar makes content uncacheable so we disable it. // Has to be done before Setup.php initialize MWDebug $wgDebugToolbar = false; // Avoid DB writes (like enotif/counters) $wgReadOnly = 'Building cache'; // avoid DB writes (like enotif/counters) parent::finalSetup(); }
public function finalSetup() { parent::finalSetup(); global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgMainWANCache; global $wgMainStash; global $wgLanguageConverterCacheType, $wgUseDatabaseMessages; global $wgLocaltimezone, $wgLocalisationCacheConf; global $wgDevelopmentWarnings; global $wgSessionProviders; global $wgJobTypeConf; // Inject test autoloader require_once __DIR__ . '/../TestsAutoLoader.php'; // wfWarn should cause tests to fail $wgDevelopmentWarnings = true; // Make sure all caches and stashes are either disabled or use // in-process cache only to prevent tests from using any preconfigured // cache meant for the local wiki from outside the test run. // See also MediaWikiTestCase::run() which mocks CACHE_DB and APC. // Disabled in DefaultSettings, override local settings $wgMainWANCache = $wgMainCacheType = CACHE_NONE; // Uses CACHE_ANYTHING in DefaultSettings, use hash instead of db $wgMessageCacheType = $wgParserCacheType = $wgSessionCacheType = $wgLanguageConverterCacheType = 'hash'; // Uses db-replicated in DefaultSettings $wgMainStash = 'hash'; // Use memory job queue $wgJobTypeConf = array('default' => array('class' => 'JobQueueMemory', 'order' => 'fifo')); $wgUseDatabaseMessages = false; # Set for future resets // Assume UTC for testing purposes $wgLocaltimezone = 'UTC'; $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('AlternateUserMailer', function () { return false; }); // xdebug's default of 100 is too low for MediaWiki ini_set('xdebug.max_nesting_level', 1000); // Bug T116683 serialize_precision of 100 // may break testing against floating point values // treated with PHP's serialize() ini_set('serialize_precision', 17); }
public function finalSetup() { parent::finalSetup(); global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType; global $wgLanguageConverterCacheType, $wgUseDatabaseMessages; global $wgLocaltimezone, $wgLocalisationCacheConf; global $wgDevelopmentWarnings; // wfWarn should cause tests to fail $wgDevelopmentWarnings = true; $wgMainCacheType = CACHE_NONE; $wgMessageCacheType = CACHE_NONE; $wgParserCacheType = CACHE_NONE; $wgLanguageConverterCacheType = CACHE_NONE; $wgUseDatabaseMessages = false; # Set for future resets // Assume UTC for testing purposes $wgLocaltimezone = 'UTC'; $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null'; }
public function finalSetup() { parent::finalSetup(); global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType; global $wgLanguageConverterCacheType, $wgUseDatabaseMessages; global $wgLocaltimezone, $wgLocalisationCacheConf; global $wgDevelopmentWarnings; // wfWarn should cause tests to fail $wgDevelopmentWarnings = true; $wgMainCacheType = CACHE_NONE; $wgMessageCacheType = CACHE_NONE; $wgParserCacheType = CACHE_NONE; $wgLanguageConverterCacheType = CACHE_NONE; $wgUseDatabaseMessages = false; # Set for future resets // Assume UTC for testing purposes $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; }); }