protected function setUp() { parent::setUp(); $langObj = Language::factory('en'); $localZone = 'UTC'; $localOffset = date('Z') / 60; $this->setMwGlobals(array('wgMemc' => new EmptyBagOStuff(), 'wgContLang' => $langObj, 'wgLang' => $langObj, 'wgLocaltimezone' => $localZone, 'wgLocalTZoffset' => $localOffset, 'wgNamespaceProtection' => array(NS_MEDIAWIKI => 'editinterface'))); $this->userName = '******'; $this->altUserName = '******'; date_default_timezone_set($localZone); $this->title = Title::makeTitle(NS_MAIN, "Main Page"); if (!isset($this->userUser) || !$this->userUser instanceof User) { $this->userUser = User::newFromName($this->userName); if (!$this->userUser->getID()) { $this->userUser = User::createNew($this->userName, array("email" => "*****@*****.**", "real_name" => "Test User")); $this->userUser->load(); } $this->altUser = User::newFromName($this->altUserName); if (!$this->altUser->getID()) { $this->altUser = User::createNew($this->altUserName, array("email" => "*****@*****.**", "real_name" => "Test User Alt")); $this->altUser->load(); } $this->anonUser = User::newFromId(0); $this->user = $this->userUser; } }
protected function setUp() { parent::setUp(); $this->setMwGlobals(['wgContLang' => Language::factory('tg'), 'wgLanguageCode' => 'tg', 'wgDefaultLanguageVariant' => false, 'wgRequest' => new FauxRequest([]), 'wgUser' => new User()]); $this->lang = new LanguageToTest(); $this->lc = new TestConverter($this->lang, 'tg', ['tg', 'tg-latn']); }
public function setUp() { parent::setUp(); global $wgLocalTZoffset; self::$offset = $wgLocalTZoffset; $this->iniSet('precision', 15); }
function setUp() { global $wgDefaultUserOptions; parent::setUp(); //ensure the correct default gender $wgDefaultUserOptions['gender'] = 'unknown'; }
function setUp() { global $wgLocaltimezone, $wgLocalTZoffset, $wgMemc, $wgContLang, $wgLang; parent::setUp(); if (!$wgMemc) { $wgMemc = new EmptyBagOStuff(); } $wgContLang = $wgLang = Language::factory('en'); $this->userName = "******"; $this->altUserName = "******"; date_default_timezone_set($wgLocaltimezone); $wgLocalTZoffset = date("Z") / 60; $this->title = Title::makeTitle(NS_MAIN, "Main Page"); if (!isset($this->userUser) || !$this->userUser instanceof User) { $this->userUser = User::newFromName($this->userName); if (!$this->userUser->getID()) { $this->userUser = User::createNew($this->userName, array("email" => "*****@*****.**", "real_name" => "Test User")); $this->userUser->load(); } $this->altUser = User::newFromName($this->altUserName); if (!$this->altUser->getID()) { $this->altUser = User::createNew($this->altUserName, array("email" => "*****@*****.**", "real_name" => "Test User Alt")); $this->altUser->load(); } $this->anonUser = User::newFromId(0); $this->user = $this->userUser; } }
protected function setUp() { global $wgExtraNamespaces, $wgNamespaceContentModels, $wgContentHandlers, $wgContLang; parent::setUp(); $wgExtraNamespaces[12312] = 'Dummy'; $wgExtraNamespaces[12313] = 'Dummy_talk'; $wgNamespaceContentModels[12312] = 'DUMMY'; $wgContentHandlers['DUMMY'] = 'DummyContentHandlerForTesting'; MWNamespace::getCanonicalNamespaces(true); # reset namespace cache $wgContLang->resetNamespaces(); # reset namespace cache if (!$this->the_properties) { $this->the_properties = array("property1" => "value1", "property2" => "value2", "property3" => "value3", "property4" => "value4"); } if (!$this->title1) { $page = $this->createPage('PagePropsTest_page_1', "just a dummy page", CONTENT_MODEL_WIKITEXT); $this->title1 = $page->getTitle(); $page1ID = $this->title1->getArticleID(); $this->setProperties($page1ID, $this->the_properties); } if (!$this->title2) { $page = $this->createPage('PagePropsTest_page_2', "just a dummy page", CONTENT_MODEL_WIKITEXT); $this->title2 = $page->getTitle(); $page2ID = $this->title2->getArticleID(); $this->setProperties($page2ID, $this->the_properties); } }
protected function setUp() { parent::setUp(); $this->setMwGlobals(array('wgContLang' => Language::factory('tg'), 'wgLanguageCode' => 'tg', 'wgDefaultLanguageVariant' => false, 'wgMemc' => new EmptyBagOStuff(), 'wgRequest' => new FauxRequest(array()), 'wgUser' => new User())); $this->lang = new LanguageToTest(); $this->lc = new TestConverter($this->lang, 'tg', array('tg', 'tg-latn')); }
/** * Anything that needs to happen before your tests should go here. */ function setUp() { global $wgContLang; parent::setUp(); /* For example, we need to set $wgContLang for creating a new Title */ $wgContLang = Language::factory('en'); }
protected function setUp() { parent::setUp(); $this->pages_to_delete = array(); LinkCache::singleton()->clear(); # avoid cached redirect status, etc }
protected function setUp() { parent::setUp(); // Avoid 'GetHumanTimestamp' hook and others $this->setMwGlobals('wgHooks', array()); RequestContext::getMain()->setLanguage(Language::factory('en')); }
protected function setUp() { parent::setUp(); $this->initMessagesHref(); $this->skin = new SkinTemplate(); $this->skin->getContext()->setLanguage(Language::factory('en')); }
protected function setUp() { parent::setUp(); if (!extension_loaded('intl')) { $this->markTestSkipped('These tests require intl extension'); } }
protected function setUp() { parent::setUp(); $dbw = wfGetDB(DB_MASTER); $dbw->replace('interwiki', ['iw_prefix'], ['iw_prefix' => 'linksupdatetest', 'iw_url' => 'http://testing.com/wiki/$1', 'iw_api' => 'http://testing.com/w/api.php', 'iw_local' => 0, 'iw_trans' => 0, 'iw_wikiid' => 'linksupdatetest']); $this->setMwGlobals('wgRCWatchCategoryMembership', true); }
public function setUp() { parent::setUp(); self::$notifyCallCounter = 0; self::$mockRecentChange = self::getMock('RecentChange'); $this->setContentLang('qqx'); }
public function setUp() { parent::setUp(); $conf = new SiteConfiguration(); $conf->settings = array('wgServer' => array('enwiki' => 'http://en.example.org', 'ruwiki' => '//ru.example.org'), 'wgArticlePath' => array('enwiki' => '/w/$1', 'ruwiki' => '/wiki/$1')); $conf->suffixes = array('wiki'); $this->setMwGlobals(array('wgConf' => $conf)); }
public function setUp() { parent::setUp(); $user = User::newFromName('UserThatExists'); if (!$user->getId()) { $user->addToDatabase(); } }
protected function setUp() { parent::setUp(); if (!$this->isWikitextNS(NS_MAIN)) { $this->markTestSkipped('Main namespace does not support wikitext.'); } // Avoid special pages from extensions interferring with the tests $this->setMwGlobals('wgSpecialPages', array()); }
public function setUp() { parent::setUp(); $conf = new SiteConfiguration(); $conf->settings = ['wgServer' => ['enwiki' => 'http://en.example.org', 'ruwiki' => '//ru.example.org'], 'wgArticlePath' => ['enwiki' => '/w/$1', 'ruwiki' => '/wiki/$1']]; $conf->suffixes = ['wiki']; $this->setMwGlobals(['wgConf' => $conf]); TestSites::insertIntoDb(); }
/** * Anything that needs to happen before your tests should go here. */ protected function setUp() { // Be sure to do call the parent setup and teardown functions. // This makes sure that all the various cleanup and restorations // happen as they should (including the restoration for setMwGlobals). parent::setUp(); // This sets the globals and will restore them automatically // after each test. $this->setMwGlobals(array('wgContLang' => Language::factory('en'))); }
/** * Default set up function. * * Clears $wgUser, and reports errors from addDBData to PHPUnit */ protected function setUp() { parent::setUp(); // Check if any Exception is stored for rethrowing from addDBData // @see self::exceptionFromAddDBData if ($this->exceptionFromAddDBData !== null) { throw $this->exceptionFromAddDBData; } $this->setMwGlobals('wgUser', new User()); }
protected function setUp() { global $wgServer; parent::setUp(); self::$apiUrl = $wgServer . wfScript('api'); ApiQueryInfo::resetTokenCache(); // tokens are invalid because we cleared the session self::$users = array('sysop' => new TestUser('Apitestsysop', 'Api Test Sysop', '*****@*****.**', array('sysop')), 'uploader' => new TestUser('Apitestuser', 'Api Test User', '*****@*****.**', array())); $this->setMwGlobals(array('wgAuth' => new StubObject('wgAuth', 'AuthPlugin'), 'wgRequest' => new FauxRequest(array()), 'wgUser' => self::$users['sysop']->user)); $this->apiContext = new ApiTestContext(); }
protected function setUp() { parent::setUp(); // Anon user $user = new User(); $user->setName('127.0.0.1'); $this->setMwGlobals(array('wgUser' => $user, 'wgTextModelsToParse' => array(CONTENT_MODEL_WIKITEXT, CONTENT_MODEL_CSS, CONTENT_MODEL_JAVASCRIPT), 'wgUseTidy' => false, 'wgAlwaysUseTidy' => false)); $this->context = new RequestContext(new FauxRequest()); $this->context->setTitle(Title::newFromText('Test')); $this->context->setUser($user); }
function setUp() { parent::setUp(); global $wgMemc, $wgRequest, $wgUser, $wgContLang; $wgUser = new User(); $wgRequest = new FauxRequest(array()); $wgMemc = new EmptyBagOStuff(); $wgContLang = Language::factory('tg'); $this->lang = new LanguageToTest(); $this->lc = new TestConverter($this->lang, 'tg', array('tg', 'tg-latn')); }
protected function setUp() { global $wgContLang; parent::setUp(); $this->mergeMwGlobalArrayValue('wgExtraNamespaces', array(12302 => 'TEST-JS', 12303 => 'TEST-JS_TALK')); $this->mergeMwGlobalArrayValue('wgNamespaceContentModels', array(12302 => CONTENT_MODEL_JAVASCRIPT)); MWNamespace::getCanonicalNamespaces(true); # reset namespace cache $wgContLang->resetNamespaces(); # reset namespace cache }
protected function setUp() { global $wgServer, $wgDisableAuthManager; parent::setUp(); self::$apiUrl = $wgServer . wfScript('api'); ApiQueryInfo::resetTokenCache(); // tokens are invalid because we cleared the session self::$users = ['sysop' => static::getTestSysop(), 'uploader' => static::getTestUser()]; $this->setMwGlobals(['wgAuth' => $wgDisableAuthManager ? new AuthPlugin() : new MediaWiki\Auth\AuthManagerAuthPlugin(), 'wgRequest' => new FauxRequest([]), 'wgUser' => self::$users['sysop']->user]); $this->apiContext = new ApiTestContext(); }
/** * Default set up function. * * Clears $wgUser, and reports errors from addDBData to PHPUnit */ public function setUp() { global $wgUser; parent::setUp(); // Check if any Exception is stored for rethrowing from addDBData // @see self::exceptionFromAddDBData if ($this->exceptionFromAddDBData !== null) { throw $this->exceptionFromAddDBData; } $wgUser = new User(); }
protected function setUp() { parent::setUp(); // Anon user $user = new User(); $user->setName('127.0.0.1'); $this->context = new RequestContext(new FauxRequest()); $this->context->setTitle(Title::newFromText('Test')); $this->context->setUser($user); $this->setMwGlobals(['wgUser' => $user, 'wgTextModelsToParse' => [CONTENT_MODEL_WIKITEXT, CONTENT_MODEL_CSS, CONTENT_MODEL_JAVASCRIPT], 'wgUseTidy' => false, 'wgCapitalLinks' => true, 'wgHooks' => []]); MWTidy::destroySingleton(); }
protected function setUp() { parent::setUp(); $this->mUserMock = $this->getMockBuilder('User')->disableOriginalConstructor()->getMock(); // Create a new context $this->mContext = new DerivativeContext(new RequestContext()); $this->mContext->setUser($this->mUserMock); $main = new ApiMain($this->mContext); // Empty session $this->mSession = array(); $this->mTested = new ApiOptions($main, 'options'); }
protected function setUp() { parent::setUp(); if (!$this->isWikitextNS(NS_MAIN)) { $this->markTestSkipped('Main namespace does not support wikitext.'); } // Avoid special pages from extensions interferring with the tests $this->setMwGlobals(['wgSpecialPages' => [], 'wgHooks' => []]); $this->originalHandlers = TestingAccessWrapper::newFromClass('Hooks')->handlers; TestingAccessWrapper::newFromClass('Hooks')->handlers = []; SpecialPageFactory::resetList(); }
protected function setUp() { parent::setUp(); $langObj = Language::factory('en'); $localZone = 'UTC'; $localOffset = date('Z') / 60; $this->setMwGlobals(array('wgMemc' => new EmptyBagOStuff(), 'wgContLang' => $langObj, 'wgLanguageCode' => 'en', 'wgLang' => $langObj, 'wgLocaltimezone' => $localZone, 'wgLocalTZoffset' => $localOffset, 'wgNamespaceProtection' => array(NS_MEDIAWIKI => 'editinterface'))); // Without this testUserBlock will use a non-English context on non-English MediaWiki // installations (because of how Title::checkUserBlock is implemented) and fail. RequestContext::resetMain(); $this->userName = '******'; $this->altUserName = '******'; date_default_timezone_set($localZone); $this->title = Title::makeTitle(NS_MAIN, "Main Page"); if (!isset($this->userUser) || !$this->userUser instanceof User) { $this->userUser = User::newFromName($this->userName); if (!$this->userUser->getID()) { $this->userUser = User::createNew($this->userName, array("email" => "*****@*****.**", "real_name" => "Test User")); $this->userUser->load(); } $this->altUser = User::newFromName($this->altUserName); if (!$this->altUser->getID()) { $this->altUser = User::createNew($this->altUserName, array("email" => "*****@*****.**", "real_name" => "Test User Alt")); $this->altUser->load(); } $this->anonUser = User::newFromId(0); $this->user = $this->userUser; } }