X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_add%27%29%20%7D%7D?a=blobdiff_plain;f=tests%2Fphpunit%2FMediaWikiTestCase.php;h=fd0cea1023c2ca00c415c6d094bffc16ab5fd24f;hb=013b6fac88f03a7417c09e578a3bf1828e1101c6;hp=c35f5d6357d084b6041b59b600ccc9572c8b021b;hpb=76661cf129e0dea40edefbd7d35a3f09130572a1;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index c35f5d6357..fd0cea1023 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -1627,6 +1627,10 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase { if ( $tablesToRestore ) { $this->recloneMockTables( $db, $tablesToRestore ); + + // Reset the restored tables, mainly for the side effect of + // re-calling $this->addCoreDBData() if necessary. + $this->resetDB( $db, $tablesToRestore ); } } @@ -1641,6 +1645,7 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase { if ( $oldOverrides['alter'] || $oldOverrides['create'] || $oldOverrides['drop'] ) { $this->undoSchemaOverrides( $db, $oldOverrides ); + unset( $db->_schemaOverrides ); } // Determine new overrides. @@ -1792,6 +1797,12 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase { if ( array_intersect( $tablesUsed, $userTables ) ) { $tablesUsed = array_unique( array_merge( $tablesUsed, $userTables ) ); TestUserRegistry::clear(); + + // Reset $wgUser, which is probably 127.0.0.1, as its loaded data is probably not valid + // @todo Should we start setting $wgUser to something nondeterministic + // to encourage tests to be updated to not depend on it? + global $wgUser; + $wgUser->clearInstanceCache( $wgUser->mFrom ); } if ( array_intersect( $tablesUsed, $pageTables ) ) { $tablesUsed = array_unique( array_merge( $tablesUsed, $pageTables ) );