Implement mw.requestIdleCallback for deferred background tasks
[lhc/web/wiklou.git] / tests / phpunit / MediaWikiTestCase.php
index 9bbbf9f..9e4a984 100644 (file)
@@ -181,7 +181,6 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
                $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 );
@@ -208,7 +207,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
                if ( $this->needsDB() && $this->db ) {
                        // Clean up open transactions
                        while ( $this->db->trxLevel() > 0 ) {
-                               $this->db->rollback();
+                               $this->db->rollback( __METHOD__, 'flush' );
                        }
                }
 
@@ -242,7 +241,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
                if ( $this->needsDB() && $this->db ) {
                        // Clean up open transactions
                        while ( $this->db->trxLevel() > 0 ) {
-                               $this->db->rollback();
+                               $this->db->rollback( __METHOD__, 'flush' );
                        }
                }
 
@@ -493,13 +492,13 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
 
                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 ) {