* Fix db->makeList() spacing
authorAntoine Musso <hashar@users.mediawiki.org>
Sat, 28 May 2011 09:03:44 +0000 (09:03 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sat, 28 May 2011 09:03:44 +0000 (09:03 +0000)
* Tests assertions where upside-down (expected <-> value)
* Tests did not use LIST_AND

Follow up r87992

includes/db/Database.php
tests/phpunit/includes/db/DatabaseTest.php

index 8dc2a76..c181a11 100644 (file)
@@ -1484,7 +1484,7 @@ abstract class DatabaseBase implements DatabaseType {
                                        $list .= $field . $operator . $this->addQuotes( $value[0] );
                                } else {
                                        $operator = $not ? ' NOT IN ' : ' IN ';
-                                       $list .= $field . $operator . " (" . $this->makeList( $value ) . ") ";
+                                       $list .= $field . $operator . "(" . $this->makeList( $value ) . ")";
                                }
                        } elseif ( $value === null ) {
                                if ( $mode == LIST_AND || $mode == LIST_OR ) {
index 5fac8dc..e886fa8 100644 (file)
@@ -92,30 +92,30 @@ class DatabaseTest extends MediaWikiTestCase {
 
        function testMakeNotInList() {
                $this->assertEquals(
+                       "field IN ('0','1')",
                        $this->db->makeList( array(
                                'field' => array( 0, 1 )
-                       ) ),
-                       "field IN ('0','1')"
+                       ), LIST_AND )
                );
                $this->assertEquals(
+                       "field NOT IN ('0','1')",
                        $this->db->makeList( array(
                                'field!' => array( 0, 1 )
-                       ) ),
-                       "field NOT IN ('0','1')"
+                       ), LIST_AND )
                );
 
                // make sure an array with only one value use = or !=
                $this->assertEquals(
+                       "field = '777'",
                        $this->db->makeList( array(
                                'field' => array( 777 )
-                       ) ),
-                       "field = 777"
+                       ), LIST_AND )
                );
                $this->assertEquals(
+                       "field != '888'",
                        $this->db->makeList( array(
                                'field!' => array( 888 )
-                       ) ),
-                       "field != 888"
+                       ), LIST_AND )
                );
        }
 }