From 02077c9901fe73f6c3c632c545e0ad70994a4407 Mon Sep 17 00:00:00 2001 From: X! Date: Fri, 31 Dec 2010 21:10:36 +0000 Subject: [PATCH] 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. --- tests/phpunit/MediaWikiTestCase.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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." ); + } + } } -- 2.20.1