Merge "Fix DatabaseSqlite::__toString"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 5 Oct 2015 21:03:39 +0000 (21:03 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 5 Oct 2015 21:03:39 +0000 (21:03 +0000)
includes/db/DatabaseSqlite.php
tests/phpunit/includes/db/DatabaseSqliteTest.php

index e909597..dd65042 100644 (file)
@@ -1032,6 +1032,14 @@ class DatabaseSqlite extends DatabaseBase {
 
                return $endArray;
        }
+
+       /**
+        * @return string
+        */
+       public function __toString() {
+               return 'SQLite ' . (string)$this->mConn->getAttribute( PDO::ATTR_SERVER_VERSION );
+       }
+
 } // end DatabaseSqlite class
 
 /**
index 9307b0c..0db7af9 100644 (file)
@@ -482,4 +482,12 @@ class DatabaseSqliteTest extends MediaWikiTestCase {
 
                $this->assertTrue( $db->close(), "closing database" );
        }
+
+       public function testToString() {
+               $db = DatabaseSqlite::newStandaloneInstance( ':memory:' );
+
+               $toString = (string)$db;
+
+               $this->assertContains( 'SQLite ', $toString );
+       }
 }