Merge "Force case-sensitivity on the LIKE operator, to ensure similar behaviour betwe...
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 31 Jan 2013 20:49:56 +0000 (20:49 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 31 Jan 2013 20:49:56 +0000 (20:49 +0000)
1  2 
tests/phpunit/includes/db/DatabaseSqliteTest.php

@@@ -12,10 -12,7 +12,10 @@@ class MockDatabaseSqlite extends Databa
                return true;
        }
  
 -      function replaceVars( $s ) {
 +      /**
 +       * Override parent visibility to public
 +       */
 +      public function replaceVars( $s ) {
                return parent::replaceVars( $s );
        }
  }
@@@ -235,7 -232,7 +235,7 @@@ class DatabaseSqliteTest extends MediaW
         * @todo: currently only checks list of tables
         */
        public function testUpgrades() {
 -              global $IP, $wgVersion;
 +              global $IP, $wgVersion, $wgProfileToDatabase;
  
                // Versions tested
                $versions = array(
  
                $currentDB = new DatabaseSqliteStandalone( ':memory:' );
                $currentDB->sourceFile( "$IP/maintenance/tables.sql" );
 +              if ( $wgProfileToDatabase ) {
 +                      $currentDB->sourceFile( "$IP/maintenance/sqlite/archives/patch-profiling.sql" );
 +              }
                $currentTables = $this->getTables( $currentDB );
                sort( $currentTables );
  
                ksort( $indexes );
                return $indexes;
        }
+       function testCaseInsensitiveLike() {
+               // TODO: Test this for all databases
+               $db = new DatabaseSqliteStandalone( ':memory:' );\r
+               $res = $db->query( 'SELECT "a" LIKE "A" AS a' );\r
+               $row = $res->fetchRow();\r
+               $this->assertFalse( (bool)$row['a'] );\r
+       }
  }