Add check to make sure only MySQL and SQLite are used at the moment. These two are...
authorX! <soxred93@users.mediawiki.org>
Fri, 31 Dec 2010 21:10:36 +0000 (21:10 +0000)
committerX! <soxred93@users.mediawiki.org>
Fri, 31 Dec 2010 21:10:36 +0000 (21:10 +0000)
tests/phpunit/MediaWikiTestCase.php

index cc849d9..8f54280 100644 (file)
@@ -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." );
+               }
+       }
 }