<?php
+
use Wikimedia\ScopedCallback;
/**
/** @var ScopedCallback */
private $ptTeardownScope;
+ private $oldTablePrefix = '';
+
/**
* @defgroup filtering_constants Filtering constants
*
public function setUp() {
wfDebug( __METHOD__ );
+
$db = wfGetDB( DB_MASTER );
$type = $db->getType();
$prefix = $type === 'oracle' ?
MediaWikiTestCase::ORA_DB_PREFIX : MediaWikiTestCase::DB_PREFIX;
+ $this->oldTablePrefix = $db->tablePrefix();
MediaWikiTestCase::setupTestDB( $db, $prefix );
- $teardown = $this->ptRunner->setDatabase( $db );
+ CloneDatabase::changePrefix( $prefix );
+
+ $this->ptRunner->setDatabase( $db );
+
+ MediaWikiTestCase::resetNonServiceCaches();
+
+ MediaWikiTestCase::installMockMwServices();
+ $teardown = new ScopedCallback( function () {
+ MediaWikiTestCase::restoreMwServices();
+ } );
+
$teardown = $this->ptRunner->setupUploads( $teardown );
$this->ptTeardownScope = $teardown;
}
if ( $this->ptTeardownScope ) {
ScopedCallback::consume( $this->ptTeardownScope );
}
+ CloneDatabase::changePrefix( $this->oldTablePrefix );
}
/**