本文整理匯總了PHP中MediaWikiTestCase::reuseDB方法的典型用法代碼示例。如果您正苦於以下問題:PHP MediaWikiTestCase::reuseDB方法的具體用法?PHP MediaWikiTestCase::reuseDB怎麽用?PHP MediaWikiTestCase::reuseDB使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MediaWikiTestCase
的用法示例。
在下文中一共展示了MediaWikiTestCase::reuseDB方法的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)');
}
}
示例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();
}
}
示例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);
}
}