r79374 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79373‎ | r79374 | r79375 >
Date:21:10, 31 December 2010
Author:soxred93
Status:ok
Tags:
Comment:
Add check to make sure only MySQL and SQLite are used at the moment. These two are the only ones with the listTables() function, and the only ones that are tested.
Modified paths:
  • /trunk/phase3/tests/phpunit/MediaWikiTestCase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/MediaWikiTestCase.php
@@ -9,6 +9,11 @@
1010 protected $dbClone;
1111 protected $oldTablePrefix;
1212 protected $useTemporaryTables = true;
 13+
 14+ protected $supportedDBs = array(
 15+ 'mysql',
 16+ 'sqlite'
 17+ );
1318
1419 function __construct( $name = null, array $data = array(), $dataName = '' ) {
1520 if ($name !== null) {
@@ -29,6 +34,9 @@
3035 global $wgDBprefix;
3136
3237 $this->db = wfGetDB( DB_MASTER );
 38+
 39+ $this->checkDbIsSupported();
 40+
3341 $this->oldTablePrefix = $wgDBprefix;
3442
3543 $this->destroyDB();
@@ -174,5 +182,11 @@
175183 return $tables;
176184
177185 }
 186+
 187+ protected function checkDbIsSupported() {
 188+ if( !in_array( $this->db->getType(), $this->supportedDBs ) ) {
 189+ throw new MWException( $this->db->getType() . " is not currently supported for unit testing." );
 190+ }
 191+ }
178192 }
179193

Status & tagging log