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


PHP MediaWikiTestCase::useTemporaryTables方法代码示例

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


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

示例1: run

 function run(PHPUnit_Framework_TestResult $result = null)
 {
     /* Some functions require some kind of caching, and will end up using the db,
      * which we can't allow, as that would open a new connection for mysql.
      * Replace with a HashBag. They would not be going to persist anyway.
      */
     ObjectCache::$instances[CACHE_DB] = new HashBagOStuff();
     $needsResetDB = false;
     $logName = get_class($this) . '::' . $this->getName(false);
     if ($this->needsDB()) {
         // set up a DB connection for this test to use
         self::$useTemporaryTables = !$this->getCliArg('use-normal-tables');
         self::$reuseDB = $this->getCliArg('reuse-db');
         $this->db = wfGetDB(DB_MASTER);
         $this->checkDbIsSupported();
         if (!self::$dbSetup) {
             wfProfileIn($logName . ' (clone-db)');
             // switch to a temporary clone of the database
             self::setupTestDB($this->db, $this->dbPrefix());
             if (($this->db->getType() == 'oracle' || !self::$useTemporaryTables) && self::$reuseDB) {
                 $this->resetDB();
             }
             wfProfileOut($logName . ' (clone-db)');
         }
         wfProfileIn($logName . ' (prepare-db)');
         $this->addCoreDBData();
         $this->addDBData();
         wfProfileOut($logName . ' (prepare-db)');
         $needsResetDB = true;
     }
     wfProfileIn($logName);
     parent::run($result);
     wfProfileOut($logName);
     if ($needsResetDB) {
         wfProfileIn($logName . ' (reset-db)');
         $this->resetDB();
         wfProfileOut($logName . ' (reset-db)');
     }
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:39,代码来源:MediaWikiTestCase.php

示例2: run

 public function run(PHPUnit_Framework_TestResult $result = null)
 {
     /* Some functions require some kind of caching, and will end up using the db,
      * which we can't allow, as that would open a new connection for mysql.
      * Replace with a HashBag. They would not be going to persist anyway.
      */
     ObjectCache::$instances[CACHE_DB] = new HashBagOStuff();
     // Sandbox APC by replacing with in-process hash instead.
     // Ensures values are removed between tests.
     ObjectCache::$instances['apc'] = ObjectCache::$instances['xcache'] = ObjectCache::$instances['wincache'] = new HashBagOStuff();
     $needsResetDB = false;
     if ($this->needsDB()) {
         // set up a DB connection for this test to use
         self::$useTemporaryTables = !$this->getCliArg('use-normal-tables');
         self::$reuseDB = $this->getCliArg('reuse-db');
         $this->db = wfGetDB(DB_MASTER);
         $this->checkDbIsSupported();
         if (!self::$dbSetup) {
             // switch to a temporary clone of the database
             self::setupTestDB($this->db, $this->dbPrefix());
             if (($this->db->getType() == 'oracle' || !self::$useTemporaryTables) && self::$reuseDB) {
                 $this->resetDB();
             }
         }
         $this->addCoreDBData();
         $this->addDBData();
         $needsResetDB = true;
     }
     parent::run($result);
     if ($needsResetDB) {
         $this->resetDB();
     }
 }
开发者ID:admonkey,项目名称:mediawiki,代码行数:33,代码来源:MediaWikiTestCase.php

示例3: run

 public function run(PHPUnit_Framework_TestResult $result = null)
 {
     // Reset all caches between tests.
     $this->doLightweightServiceReset();
     $needsResetDB = false;
     if (!self::$dbSetup || $this->needsDB()) {
         // set up a DB connection for this test to use
         self::$useTemporaryTables = !$this->getCliArg('use-normal-tables');
         self::$reuseDB = $this->getCliArg('reuse-db');
         $this->db = wfGetDB(DB_MASTER);
         $this->checkDbIsSupported();
         if (!self::$dbSetup) {
             $this->setupAllTestDBs();
             $this->addCoreDBData();
             if (($this->db->getType() == 'oracle' || !self::$useTemporaryTables) && self::$reuseDB) {
                 $this->resetDB($this->db, $this->tablesUsed);
             }
         }
         // TODO: the DB setup should be done in setUpBeforeClass(), so the test DB
         // is available in subclass's setUpBeforeClass() and setUp() methods.
         // This would also remove the need for the HACK that is oncePerClass().
         if ($this->oncePerClass()) {
             $this->addDBDataOnce();
         }
         $this->addDBData();
         $needsResetDB = true;
     }
     parent::run($result);
     if ($needsResetDB) {
         $this->resetDB($this->db, $this->tablesUsed);
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:32,代码来源:MediaWikiTestCase.php


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