当前位置: 首页>>代码示例>>PHP>>正文


PHP RequestContext::resetMain方法代码示例

本文整理汇总了PHP中RequestContext::resetMain方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestContext::resetMain方法的具体用法?PHP RequestContext::resetMain怎么用?PHP RequestContext::resetMain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RequestContext的用法示例。


在下文中一共展示了RequestContext::resetMain方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doTestLogFormatter

 public function doTestLogFormatter($row, $extra)
 {
     RequestContext::resetMain();
     $row = $this->expandDatabaseRow($row, $this->isLegacy($extra));
     $formatter = LogFormatter::newFromRow($row);
     $this->assertEquals($extra['text'], self::removeSomeHtml($formatter->getActionText()), 'Action text is equal to expected text');
     $this->assertSame($extra['api'], self::removeApiMetaData($formatter->formatParametersForApi()), 'Api log params is equal to expected array');
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:8,代码来源:LogFormatterTestCase.php

示例2: setUp

 protected function setUp()
 {
     global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc, $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgParserCacheType, $wgNamespaceAliases, $wgNamespaceProtection, $parserMemc;
     $tmpDir = $this->getNewTempDirectory();
     $tmpGlobals = [];
     $tmpGlobals['wgScript'] = '/index.php';
     $tmpGlobals['wgScriptPath'] = '/';
     $tmpGlobals['wgArticlePath'] = '/wiki/$1';
     $tmpGlobals['wgStylePath'] = '/skins';
     $tmpGlobals['wgThumbnailScriptPath'] = false;
     $tmpGlobals['wgLocalFileRepo'] = ['class' => 'LocalRepo', 'name' => 'local', 'url' => 'http://example.com/images', 'hashLevels' => 2, 'transformVia404' => false, 'backend' => new FSFileBackend(['name' => 'local-backend', 'wikiId' => wfWikiID(), 'containerPaths' => ['local-public' => "{$tmpDir}/test-repo/public", 'local-thumb' => "{$tmpDir}/test-repo/thumb", 'local-temp' => "{$tmpDir}/test-repo/temp", 'local-deleted' => "{$tmpDir}/test-repo/delete"]])];
     foreach ($tmpGlobals as $var => $val) {
         if (array_key_exists($var, $GLOBALS)) {
             $this->savedGlobals[$var] = $GLOBALS[$var];
         }
         $GLOBALS[$var] = $val;
     }
     $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface';
     $wgNamespaceAliases['Image'] = NS_FILE;
     $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
     $wgParserCacheType = CACHE_NONE;
     DeferredUpdates::clearPendingUpdates();
     $wgMemc = wfGetMainCache();
     $messageMemc = wfGetMessageCacheStorage();
     $parserMemc = wfGetParserCacheStorage();
     RequestContext::resetMain();
     $context = RequestContext::getMain();
     $wgUser = new User();
     $wgLang = $context->getLanguage();
     $wgOut = $context->getOutput();
     $wgParser = new StubObject('wgParser', $wgParserConf['class'], [$wgParserConf]);
     $wgRequest = $context->getRequest();
     if ($wgStyleDirectory === false) {
         $wgStyleDirectory = "{$IP}/skins";
     }
     RepoGroup::destroySingleton();
     FileBackendGroup::destroySingleton();
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:38,代码来源:UploadFromUrlTestSuite.php

示例3: tearDown

 protected function tearDown()
 {
     global $wgRequest;
     $status = ob_get_status();
     if (isset($status['name']) && $status['name'] === 'MediaWikiTestCase::wfResetOutputBuffersBarrier') {
         ob_end_flush();
     }
     $this->called['tearDown'] = true;
     // Cleaning up temporary files
     foreach ($this->tmpFiles as $fileName) {
         if (is_file($fileName) || is_link($fileName)) {
             unlink($fileName);
         } elseif (is_dir($fileName)) {
             wfRecursiveRemoveDir($fileName);
         }
     }
     if ($this->needsDB() && $this->db) {
         // Clean up open transactions
         while ($this->db->trxLevel() > 0) {
             $this->db->rollback(__METHOD__, 'flush');
         }
     }
     // Restore mw globals
     foreach ($this->mwGlobals as $key => $value) {
         $GLOBALS[$key] = $value;
     }
     $this->mwGlobals = array();
     RequestContext::resetMain();
     MediaHandler::resetCache();
     if (session_id() !== '') {
         session_write_close();
         session_id('');
     }
     $wgRequest = new FauxRequest();
     MediaWiki\Session\SessionManager::resetCache();
     $phpErrorLevel = intval(ini_get('error_reporting'));
     if ($phpErrorLevel !== $this->phpErrorLevel) {
         ini_set('error_reporting', $this->phpErrorLevel);
         $oldHex = strtoupper(dechex($this->phpErrorLevel));
         $newHex = strtoupper(dechex($phpErrorLevel));
         $message = "PHP error_reporting setting was left dirty: " . "was 0x{$oldHex} before test, 0x{$newHex} after test!";
         $this->fail($message);
     }
     parent::tearDown();
 }
开发者ID:admonkey,项目名称:mediawiki,代码行数:45,代码来源:MediaWikiTestCase.php

示例4: tearDown

 protected function tearDown()
 {
     wfProfileIn(__METHOD__);
     // Cleaning up temporary files
     foreach ($this->tmpFiles as $fileName) {
         if (is_file($fileName) || is_link($fileName)) {
             unlink($fileName);
         } elseif (is_dir($fileName)) {
             wfRecursiveRemoveDir($fileName);
         }
     }
     if ($this->needsDB() && $this->db) {
         // Clean up open transactions
         while ($this->db->trxLevel() > 0) {
             $this->db->rollback();
         }
         // don't ignore DB errors
         $this->db->ignoreErrors(false);
     }
     // Restore mw globals
     foreach ($this->mwGlobals as $key => $value) {
         $GLOBALS[$key] = $value;
     }
     $this->mwGlobals = array();
     RequestContext::resetMain();
     MediaHandler::resetCache();
     $phpErrorLevel = intval(ini_get('error_reporting'));
     if ($phpErrorLevel !== $this->phpErrorLevel) {
         ini_set('error_reporting', $this->phpErrorLevel);
         $oldHex = strtoupper(dechex($this->phpErrorLevel));
         $newHex = strtoupper(dechex($phpErrorLevel));
         $message = "PHP error_reporting setting was left dirty: " . "was 0x{$oldHex} before test, 0x{$newHex} after test!";
         $this->fail($message);
     }
     parent::tearDown();
     wfProfileOut(__METHOD__);
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:37,代码来源:MediaWikiTestCase.php

示例5: testBug71329

 public function testBug71329()
 {
     SpecialPageFactory::resetList();
     RequestContext::resetMain();
     $req = new FauxRequest(array('title' => 'Special:Search', 'mobileaction' => 'toggle_view_mobile'));
     $req->setRequestURL('/w/index.php?title=Special:Search&mobileaction=toggle_view_mobile');
     RequestContext::getMain()->setRequest($req);
     MobileContext::setInstance(null);
     $this->setMwGlobals('wgTitle', null);
     SpecialPage::getTitleFor('Search');
     $this->assertTrue(true, 'In case of failure this test just crashes');
 }
开发者ID:negati-ve,项目名称:openshift-mediawiki,代码行数:12,代码来源:MobileContextTest.php

示例6: resetAllEnv

 function resetAllEnv()
 {
     $_SESSION = array();
     $_GET = array();
     $_POST = array();
     $_SERVER = array();
     $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
     $_SERVER['HTTP_HOST'] = TESTS_HOSTNAME;
     $_SERVER['SERVER_NAME'] = TESTS_HOSTNAME;
     $_SERVER['SCRIPT_NAME'] = __FILE__;
     RequestContext::resetMain();
     // Wipe out the $instance of these classes to make sure they're
     // re-created with fresh gateway instances for the next test
     $singleton_classes = array('Gateway_Extras_ConversionLog', 'Gateway_Extras_CustomFilters', 'Gateway_Extras_CustomFilters_Functions', 'Gateway_Extras_CustomFilters_IP_Velocity', 'Gateway_Extras_CustomFilters_MinFraud', 'Gateway_Extras_CustomFilters_Referrer', 'Gateway_Extras_CustomFilters_Source', 'Gateway_Extras_SessionVelocityFilter');
     foreach ($singleton_classes as $singleton_class) {
         $unwrapped = TestingAccessWrapper::newFromClass($singleton_class);
         $unwrapped->instance = null;
     }
     // Reset SmashPig context
     Context::set(null);
 }
开发者ID:wikimedia,项目名称:wikimedia-fundraising-crm-vendor,代码行数:21,代码来源:DonationInterfaceTestCase.php

示例7: tearDown

 protected function tearDown()
 {
     global $wgRequest, $wgSQLMode;
     $status = ob_get_status();
     if (isset($status['name']) && $status['name'] === 'MediaWikiTestCase::wfResetOutputBuffersBarrier') {
         ob_end_flush();
     }
     $this->called['tearDown'] = true;
     // Cleaning up temporary files
     foreach ($this->tmpFiles as $fileName) {
         if (is_file($fileName) || is_link($fileName)) {
             unlink($fileName);
         } elseif (is_dir($fileName)) {
             wfRecursiveRemoveDir($fileName);
         }
     }
     if ($this->needsDB() && $this->db) {
         // Clean up open transactions
         while ($this->db->trxLevel() > 0) {
             $this->db->rollback(__METHOD__, 'flush');
         }
         if ($this->db->getType() === 'mysql') {
             $this->db->query("SET sql_mode = " . $this->db->addQuotes($wgSQLMode));
         }
     }
     // Restore mw globals
     foreach ($this->mwGlobals as $key => $value) {
         $GLOBALS[$key] = $value;
     }
     $this->mwGlobals = [];
     $this->restoreLoggers();
     if (self::$serviceLocator && MediaWikiServices::getInstance() !== self::$serviceLocator) {
         MediaWikiServices::forceGlobalInstance(self::$serviceLocator);
     }
     // TODO: move global state into MediaWikiServices
     RequestContext::resetMain();
     if (session_id() !== '') {
         session_write_close();
         session_id('');
     }
     $wgRequest = new FauxRequest();
     MediaWiki\Session\SessionManager::resetCache();
     MediaWiki\Auth\AuthManager::resetCache();
     $phpErrorLevel = intval(ini_get('error_reporting'));
     if ($phpErrorLevel !== $this->phpErrorLevel) {
         ini_set('error_reporting', $this->phpErrorLevel);
         $oldHex = strtoupper(dechex($this->phpErrorLevel));
         $newHex = strtoupper(dechex($phpErrorLevel));
         $message = "PHP error_reporting setting was left dirty: " . "was 0x{$oldHex} before test, 0x{$newHex} after test!";
         $this->fail($message);
     }
     parent::tearDown();
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:53,代码来源:MediaWikiTestCase.php

示例8: setUp

 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 = '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;
     }
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:29,代码来源:TitlePermissionTest.php


注:本文中的RequestContext::resetMain方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。