Merge "Added MapCacheLRU::getAllKeys() method"
[lhc/web/wiklou.git] / tests / phpunit / includes / db / DatabaseSqliteTest.php
index 1db6fae..d32c1a6 100644 (file)
@@ -162,6 +162,9 @@ class DatabaseSqliteTest extends MediaWikiTestCase {
                $this->assertEquals( "DROP INDEX foo -- dropping index",
                        $this->replaceVars( "DROP INDEX /*i*/foo ON /*_*/bar -- dropping index" )
                );
+               $this->assertEquals( "INSERT OR IGNORE INTO foo VALUES ('bar')",
+                       $this->replaceVars( "INSERT OR IGNORE INTO foo VALUES ('bar')" )
+               );
        }
 
        /**
@@ -269,7 +272,7 @@ class DatabaseSqliteTest extends MediaWikiTestCase {
         * @todo Currently only checks list of tables
         */
        public function testUpgrades() {
-               global $IP, $wgVersion, $wgProfileToDatabase;
+               global $IP, $wgVersion, $wgProfiler;
 
                // Versions tested
                $versions = array(
@@ -288,7 +291,18 @@ class DatabaseSqliteTest extends MediaWikiTestCase {
 
                $currentDB = new DatabaseSqliteStandalone( ':memory:' );
                $currentDB->sourceFile( "$IP/maintenance/tables.sql" );
-               if ( $wgProfileToDatabase ) {
+
+               $profileToDb = false;
+               if ( isset( $wgProfiler['output'] ) ) {
+                       $out = $wgProfiler['output'];
+                       if ( $out === 'db' ) {
+                               $profileToDb = true;
+                       } elseif ( is_array( $out ) && in_array( 'db', $out ) ) {
+                               $profileToDb = true;
+                       }
+               }
+
+               if ( $profileToDb ) {
                        $currentDB->sourceFile( "$IP/maintenance/sqlite/archives/patch-profiling.sql" );
                }
                $currentTables = $this->getTables( $currentDB );