From: X! Date: Fri, 31 Dec 2010 21:10:36 +0000 (+0000) Subject: Add check to make sure only MySQL and SQLite are used at the moment. These two are... X-Git-Tag: 1.31.0-rc.0~32946 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=02077c9901fe73f6c3c632c545e0ad70994a4407;p=lhc%2Fweb%2Fwiklou.git 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. --- diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index cc849d99cb..8f54280b12 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -9,6 +9,11 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { protected $dbClone; protected $oldTablePrefix; protected $useTemporaryTables = true; + + protected $supportedDBs = array( + 'mysql', + 'sqlite' + ); function __construct( $name = null, array $data = array(), $dataName = '' ) { if ($name !== null) { @@ -29,6 +34,9 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { global $wgDBprefix; $this->db = wfGetDB( DB_MASTER ); + + $this->checkDbIsSupported(); + $this->oldTablePrefix = $wgDBprefix; $this->destroyDB(); @@ -174,5 +182,11 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { return $tables; } + + protected function checkDbIsSupported() { + if( !in_array( $this->db->getType(), $this->supportedDBs ) ) { + throw new MWException( $this->db->getType() . " is not currently supported for unit testing." ); + } + } }