http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89028

Revision: 89028
Author:   hashar
Date:     2011-05-28 09:03:44 +0000 (Sat, 28 May 2011)
Log Message:
-----------
* Fix db->makeList() spacing 
* Tests assertions where upside-down (expected <-> value)
* Tests did not use LIST_AND

Follow up r87992

Modified Paths:
--------------
    trunk/phase3/includes/db/Database.php
    trunk/phase3/tests/phpunit/includes/db/DatabaseTest.php

Modified: trunk/phase3/includes/db/Database.php
===================================================================
--- trunk/phase3/includes/db/Database.php       2011-05-28 08:38:14 UTC (rev 
89027)
+++ trunk/phase3/includes/db/Database.php       2011-05-28 09:03:44 UTC (rev 
89028)
@@ -1484,7 +1484,7 @@
                                        $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 ) {

Modified: trunk/phase3/tests/phpunit/includes/db/DatabaseTest.php
===================================================================
--- trunk/phase3/tests/phpunit/includes/db/DatabaseTest.php     2011-05-28 
08:38:14 UTC (rev 89027)
+++ trunk/phase3/tests/phpunit/includes/db/DatabaseTest.php     2011-05-28 
09:03:44 UTC (rev 89028)
@@ -92,30 +92,30 @@
 
        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 )
                );
        }
 }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to