Index: trunk/phase3/tests/phpunit/MediaWikiTestCase.php |
— | — | @@ -9,6 +9,11 @@ |
10 | 10 | protected $dbClone; |
11 | 11 | protected $oldTablePrefix; |
12 | 12 | protected $useTemporaryTables = true; |
| 13 | + |
| 14 | + protected $supportedDBs = array( |
| 15 | + 'mysql', |
| 16 | + 'sqlite' |
| 17 | + ); |
13 | 18 | |
14 | 19 | function __construct( $name = null, array $data = array(), $dataName = '' ) { |
15 | 20 | if ($name !== null) { |
— | — | @@ -29,6 +34,9 @@ |
30 | 35 | global $wgDBprefix; |
31 | 36 | |
32 | 37 | $this->db = wfGetDB( DB_MASTER ); |
| 38 | + |
| 39 | + $this->checkDbIsSupported(); |
| 40 | + |
33 | 41 | $this->oldTablePrefix = $wgDBprefix; |
34 | 42 | |
35 | 43 | $this->destroyDB(); |
— | — | @@ -174,5 +182,11 @@ |
175 | 183 | return $tables; |
176 | 184 | |
177 | 185 | } |
| 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 | + } |
178 | 192 | } |
179 | 193 | |