*/
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() ) {
$fileName = $this->getNewTempFile();
// Converting the temporary /file/ to a /directory/
- //
// The following is not atomic, but at least we now have a single place,
// where temporary directory creation is bundled and can be improved
unlink( $fileName );
if ( $this->needsDB() && $this->db ) {
// Clean up open transactions
while ( $this->db->trxLevel() > 0 ) {
- $this->db->rollback();
+ $this->db->rollback( __METHOD__, 'flush' );
}
}
protected function tearDown() {
$status = ob_get_status();
- if ( isset( $status['name'] ) && $status['name'] === 'MediaWikiTestCase::wfResetOutputBuffersBarrier' ) {
+ if ( isset( $status['name'] ) &&
+ $status['name'] === 'MediaWikiTestCase::wfResetOutputBuffersBarrier'
+ ) {
ob_end_flush();
}
if ( $this->needsDB() && $this->db ) {
// Clean up open transactions
while ( $this->db->trxLevel() > 0 ) {
- $this->db->rollback();
+ $this->db->rollback( __METHOD__, 'flush' );
}
}
if ( $user->idForName() == 0 ) {
$user->addToDatabase();
- $user->setPassword( 'UTSysopPassword' );
-
- $user->addGroup( 'sysop' );
- $user->addGroup( 'bureaucrat' );
- $user->saveSettings();
+ TestUser::setPasswordForUser( $user, 'UTSysopPassword' );
}
+ // Always set groups, because $this->resetDB() wipes them out
+ $user->addGroup( 'sysop' );
+ $user->addGroup( 'bureaucrat' );
+
// Make 1 page with 1 revision
$page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
if ( $page->getId() == 0 ) {
/**
* Note: we are overriding this method to remove the deprecated error
- * @see https://bugzilla.wikimedia.org/show_bug.cgi?id=69505
+ * @see https://phabricator.wikimedia.org/T71505
* @see https://github.com/sebastianbergmann/phpunit/issues/1292
* @deprecated
*
* @param bool $isHtml
*/
public static function assertTag( $matcher, $actual, $message = '', $isHtml = true ) {
- //trigger_error(__METHOD__ . ' is deprecated', E_USER_DEPRECATED);
+ // trigger_error(__METHOD__ . ' is deprecated', E_USER_DEPRECATED);
self::assertTrue( self::tagMatch( $matcher, $actual, $isHtml ), $message );
}
* @param bool $isHtml
*/
public static function assertNotTag( $matcher, $actual, $message = '', $isHtml = true ) {
- //trigger_error(__METHOD__ . ' is deprecated', E_USER_DEPRECATED);
+ // trigger_error(__METHOD__ . ' is deprecated', E_USER_DEPRECATED);
self::assertFalse( self::tagMatch( $matcher, $actual, $isHtml ), $message );
}