Basic support for Postgres phpunit testing, currently throws 5 errors, 1 inc, 5 skipped
authorOverlordQ <overlordq@users.mediawiki.org>
Mon, 24 Oct 2011 19:28:31 +0000 (19:28 +0000)
committerOverlordQ <overlordq@users.mediawiki.org>
Mon, 24 Oct 2011 19:28:31 +0000 (19:28 +0000)
includes/db/DatabasePostgres.php
tests/phpunit/MediaWikiTestCase.php

index 8974dc8..04c70e6 100644 (file)
@@ -688,6 +688,24 @@ class DatabasePostgres extends DatabaseBase {
                return $this->query( 'CREATE ' . ( $temporary ? 'TEMPORARY ' : '' ) . " TABLE $newName (LIKE $oldName INCLUDING DEFAULTS)", $fname );
        }
 
+       function listTables( $prefix = null, $fname = 'DatabasePostgres::listTables' ) {
+               global $wgDBmwschema;
+               $eschema = $this->addQuotes( $wgDBmwschema );
+               $result = $this->query( "SELECT tablename FROM pg_tables WHERE schemaname = $eschema", $fname );
+
+               $endArray = array();
+
+               foreach( $result as $table ) {
+                       $vars = get_object_vars($table);
+                       $table = array_pop( $vars );
+                       if( !$prefix || strpos( $table, $prefix ) === 0 ) {
+                               $endArray[] = $table;
+                       }
+               }
+
+               return $endArray;
+       }
+
        function timestamp( $ts = 0 ) {
                return wfTimestamp( TS_POSTGRES, $ts );
        }
index fb6baf6..7a64fab 100644 (file)
@@ -22,6 +22,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
        protected $supportedDBs = array(
                'mysql',
                'sqlite',
+               'postgres',
                'oracle'
        );