From 716d85ad7e60f0d164c65e1f8423b1227d6012b7 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sat, 28 May 2011 09:03:44 +0000 Subject: [PATCH] * Fix db->makeList() spacing * Tests assertions where upside-down (expected <-> value) * Tests did not use LIST_AND Follow up r87992 --- includes/db/Database.php | 2 +- tests/phpunit/includes/db/DatabaseTest.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/db/Database.php b/includes/db/Database.php index 8dc2a76397..c181a112be 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -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 ) { diff --git a/tests/phpunit/includes/db/DatabaseTest.php b/tests/phpunit/includes/db/DatabaseTest.php index 5fac8dceef..e886fa87c9 100644 --- a/tests/phpunit/includes/db/DatabaseTest.php +++ b/tests/phpunit/includes/db/DatabaseTest.php @@ -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 ) ); } } -- 2.20.1