r82582 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82581‎ | r82582 | r82583 >
Date:23:19, 21 February 2011
Author:platonides
Status:ok
Tags:
Comment:
maintenance/commandLine.inc loads DefaultSettings, LocalSettings and then runs Setup.php
As Setup.php assigns variables based on the cache config, bootstrap.php was late on reseting them, as some objects were already created.
So we could end up with a SqlBagOStuff created there, which when later accessed (such as trying to invalidate the cache for a user) would
-as any non-sqlite SqlBagOStuff- open a new db connection. Which is precisely what we shall not be done when dealing with temporary tables
(and would indeed fail miserably due to not finding unittest_objectcache table).

In summary, reenabling temporary tables disabled in r79411.
Modified paths:
  • /trunk/phase3/tests/phpunit/MediaWikiTestCase.php (modified) (history)
  • /trunk/phase3/tests/phpunit/bootstrap.php (modified) (history)
  • /trunk/phase3/tests/phpunit/phpunit.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/bootstrap.php
@@ -28,12 +28,5 @@
2929 EOF;
3030 }
3131
32 -global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgUseDatabaseMessages, $wgMemc;
33 -$wgMainCacheType = CACHE_NONE;
34 -$wgMessageCacheType = CACHE_NONE;
35 -$wgParserCacheType = CACHE_NONE;
36 -$wgUseDatabaseMessages = false; # Set for future resets
37 -$wgMemc = new FakeMemCachedClient;
38 -
3932 /** @todo Check if this is really needed */
4033 MessageCache::destroyInstance();
Index: trunk/phase3/tests/phpunit/MediaWikiTestCase.php
@@ -115,7 +115,7 @@
116116 $prefix = $dbType != 'oracle' ? self::DB_PREFIX : self::ORA_DB_PREFIX;
117117
118118 $this->dbClone = new CloneDatabase( $this->db, $tables, $prefix );
119 - $this->dbClone->useTemporaryTables( false ); //reported problems with temp tables, disabling until fixed
 119+ $this->dbClone->useTemporaryTables( $this->useTemporaryTables );
120120 $this->dbClone->cloneTableStructure();
121121
122122 if ( $dbType == 'oracle' )
Index: trunk/phase3/tests/phpunit/phpunit.php
@@ -15,8 +15,28 @@
1616 define( 'MW_PHPUNIT_TEST', true );
1717
1818 // Start up MediaWiki in command-line mode
19 -require_once( "$IP/maintenance/commandLine.inc" );
 19+require_once( "$IP/maintenance/Maintenance.php" );
2020
 21+class PHPUnitMaintClass extends Maintenance {
 22+ public function finalSetup() {
 23+ $settings = parent::finalSetup();
 24+
 25+ global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgUseDatabaseMessages;
 26+
 27+ $wgMainCacheType = CACHE_NONE;
 28+ $wgMessageCacheType = CACHE_NONE;
 29+ $wgParserCacheType = CACHE_NONE;
 30+ $wgUseDatabaseMessages = false; # Set for future resets
 31+ }
 32+ public function execute() { }
 33+ public function getDbType() {
 34+ return Maintenance::DB_ADMIN;
 35+ }
 36+}
 37+
 38+$maintClass = 'PHPUnitMaintClass';
 39+require( RUN_MAINTENANCE_IF_MAIN );
 40+
2141 // Assume UTC for testing purposes
2242 $wgLocaltimezone = 'UTC';
2343

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r79411Start work on porting ParserTests completely into PHPunit....soxred9303:39, 1 January 2011

Status & tagging log