本文整理汇总了PHP中MediaWikiLangTestCase::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP MediaWikiLangTestCase::setUp方法的具体用法?PHP MediaWikiLangTestCase::setUp怎么用?PHP MediaWikiLangTestCase::setUp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaWikiLangTestCase
的用法示例。
在下文中一共展示了MediaWikiLangTestCase::setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
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 = 'Useruser';
$this->altUserName = 'Altuseruser';
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" => "test@example.com", "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" => "alttest@example.com", "real_name" => "Test User Alt"));
$this->altUser->load();
}
$this->anonUser = User::newFromId(0);
$this->user = $this->userUser;
}
}
示例2: setUp
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']);
}
示例3: setUp
public function setUp()
{
parent::setUp();
global $wgLocalTZoffset;
self::$offset = $wgLocalTZoffset;
$this->iniSet('precision', 15);
}
示例4: setUp
function setUp()
{
global $wgDefaultUserOptions;
parent::setUp();
//ensure the correct default gender
$wgDefaultUserOptions['gender'] = 'unknown';
}
示例5: setUp
function setUp()
{
global $wgLocaltimezone, $wgLocalTZoffset, $wgMemc, $wgContLang, $wgLang;
parent::setUp();
if (!$wgMemc) {
$wgMemc = new EmptyBagOStuff();
}
$wgContLang = $wgLang = Language::factory('en');
$this->userName = "Useruser";
$this->altUserName = "Altuseruser";
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" => "test@example.com", "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" => "alttest@example.com", "real_name" => "Test User Alt"));
$this->altUser->load();
}
$this->anonUser = User::newFromId(0);
$this->user = $this->userUser;
}
}
示例6: setUp
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);
}
}
示例7: setUp
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'));
}
示例8: setUp
/**
* 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');
}
示例9: setUp
protected function setUp()
{
parent::setUp();
$this->pages_to_delete = array();
LinkCache::singleton()->clear();
# avoid cached redirect status, etc
}
示例10: setUp
protected function setUp()
{
parent::setUp();
// Avoid 'GetHumanTimestamp' hook and others
$this->setMwGlobals('wgHooks', array());
RequestContext::getMain()->setLanguage(Language::factory('en'));
}
示例11: setUp
protected function setUp()
{
parent::setUp();
$this->initMessagesHref();
$this->skin = new SkinTemplate();
$this->skin->getContext()->setLanguage(Language::factory('en'));
}
示例12: setUp
protected function setUp()
{
parent::setUp();
if (!extension_loaded('intl')) {
$this->markTestSkipped('These tests require intl extension');
}
}
示例13: setUp
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);
}
示例14: setUp
public function setUp()
{
parent::setUp();
self::$notifyCallCounter = 0;
self::$mockRecentChange = self::getMock('RecentChange');
$this->setContentLang('qqx');
}
示例15: setUp
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));
}