* @see resetGlobalServices()
*/
private function doLightweightServiceReset() {
- global $wgRequest;
+ global $wgRequest, $wgJobClasses;
+ foreach ( $wgJobClasses as $type => $class ) {
+ JobQueueGroup::singleton()->get( $type )->delete();
+ }
JobQueueGroup::destroySingletons();
+
ObjectCache::clear();
$services = MediaWikiServices::getInstance();
$services->resetServiceForTesting( 'MainObjectStash' );
$services->resetServiceForTesting( 'LocalServerObjectCache' );
$services->getMainWANObjectCache()->clearProcessCache();
FileBackendGroup::destroySingleton();
+ DeferredUpdates::clearPendingUpdates();
// TODO: move global state into MediaWikiServices
RequestContext::resetMain();
}
public function run( PHPUnit_Framework_TestResult $result = null ) {
- // Reset all caches between tests.
- $this->doLightweightServiceReset();
-
$needsResetDB = false;
if ( !self::$dbSetup || $this->needsDB() ) {
}
}
- DeferredUpdates::clearPendingUpdates();
- ObjectCache::getMainWANInstance()->clearProcessCache();
+ // Reset all caches between tests.
+ $this->doLightweightServiceReset();
// XXX: reset maintenance triggers
// Hook into period lag checks which often happen in long-running scripts
* setupTestDB() was called. Useful if we need to perform database operations
* after the test run has finished (such as saving logs or profiling info).
*
+ * This is called by phpunit/bootstrap.php after the last test.
+ *
* @since 1.21
*/
public static function teardownTestDB() {
$db->delete( $tbl, '*', __METHOD__ );
}
- if ( $db->getType() === 'postgres' ) {
+ if ( in_array( $db->getType(), [ 'postgres', 'sqlite' ], true ) ) {
// Reset the table's sequence too.
$db->resetSequenceForTable( $tbl, __METHOD__ );
}