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


PHP MediaWikiTestCase::oldTablePrefix方法代码示例

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


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

示例1: setupTestDB

 /**
  * Creates an empty skeleton of the wiki database by cloning its structure
  * to equivalent tables using the given $prefix. Then sets MediaWiki to
  * use the new set of tables (aka schema) instead of the original set.
  *
  * This is used to generate a dummy table set, typically consisting of temporary
  * tables, that will be used by tests instead of the original wiki database tables.
  *
  * @since 1.21
  *
  * @note the original table prefix is stored in self::$oldTablePrefix. This is used
  * by teardownTestDB() to return the wiki to using the original table set.
  *
  * @note this method only works when first called. Subsequent calls have no effect,
  * even if using different parameters.
  *
  * @param DatabaseBase $db The database connection
  * @param string $prefix The prefix to use for the new table set (aka schema).
  *
  * @throws MWException If the database table prefix is already $prefix
  */
 public static function setupTestDB(DatabaseBase $db, $prefix)
 {
     global $wgDBprefix;
     if ($wgDBprefix === $prefix) {
         throw new MWException('Cannot run unit tests, the database prefix is already "' . $prefix . '"');
     }
     if (self::$dbSetup) {
         return;
     }
     $tablesCloned = self::listTables($db);
     $dbClone = new CloneDatabase($db, $tablesCloned, $prefix);
     $dbClone->useTemporaryTables(self::$useTemporaryTables);
     self::$dbSetup = true;
     self::$oldTablePrefix = $wgDBprefix;
     if (($db->getType() == 'oracle' || !self::$useTemporaryTables) && self::$reuseDB) {
         CloneDatabase::changePrefix($prefix);
         return;
     } else {
         $dbClone->cloneTableStructure();
     }
     if ($db->getType() == 'oracle') {
         $db->query('BEGIN FILL_WIKI_INFO; END;');
     }
 }
开发者ID:admonkey,项目名称:mediawiki,代码行数:45,代码来源:MediaWikiTestCase.php

示例2: setupAllTestDBs

 /**
  * Set up all test DBs
  */
 public function setupAllTestDBs()
 {
     global $wgDBprefix;
     self::$oldTablePrefix = $wgDBprefix;
     $testPrefix = $this->dbPrefix();
     // switch to a temporary clone of the database
     self::setupTestDB($this->db, $testPrefix);
     if (self::isUsingExternalStoreDB()) {
         self::setupExternalStoreTestDBs($testPrefix);
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:14,代码来源:MediaWikiTestCase.php


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