Merge "Add method parameter type documentation"
[lhc/web/wiklou.git] / tests / phpunit / includes / db / DatabaseTest.php
index 8c992c7..a3ef55a 100644 (file)
@@ -84,19 +84,29 @@ class DatabaseTest extends MediaWikiTestCase {
                        $quote = '';
                } elseif ( $this->db->getType() === 'mysql' ) {
                        $quote = '`';
+               } elseif ( $this->db->getType() === 'oracle' ) {
+                       $quote = '/*Q*/';
                } else {
                        $quote = '"';
                }
 
                if ( $database !== null ) {
-                       $database = $quote . $database . $quote . '.';
+                       if ( $this->db->getType() === 'oracle' ) {
+                               $database = $quote . $database . '.';
+                       } else {
+                               $database = $quote . $database . $quote . '.';
+                       }
                }
 
                if ( $prefix === null ) {
                        $prefix = $this->dbPrefix();
                }
 
-               return $database . $quote . $prefix . $table . $quote;
+               if ( $this->db->getType() === 'oracle' ) {
+                       return strtoupper($database . $quote . $prefix . $table);
+               } else {
+                       return $database . $quote . $prefix . $table . $quote;
+               }
        }
 
        function testTableNameLocal() {
@@ -206,7 +216,13 @@ class DatabaseTest extends MediaWikiTestCase {
 
        private function dropFunctions() {
                $this->db->query( 'DROP FUNCTION IF EXISTS mw_test_function'
-                       . ( $this->db->getType() == 'postgres'  ? '()' : '' )
+                               . ( $this->db->getType() == 'postgres' ? '()' : '' )
                );
        }
+
+       function testUnknownTableCorruptsResults() {
+               $res = $this->db->select( 'page', '*', array( 'page_id' => 1 ) );
+               $this->assertFalse( $this->db->tableExists( 'foobarbaz' ) );
+               $this->assertInternalType( 'int', $res->numRows() );
+       }
 }