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

Revision: 90219
Author:   brion
Date:     2011-06-16 17:58:26 +0000 (Thu, 16 Jun 2011)
Log Message:
-----------
* (bug 29426) Fix wrong use of Block::load's second parameter in BlockTest

It was accidentally passing a username where it should have passed a user ID, 
causing PostgreSQL's stricter comparisons to fail, while MySQL's allowed it to 
run without complaint but returned bad results.
Of course that bug got hidden by the test.... testing the wrong thing... :)

Now correctly loads using the user id instead of name, checks the proper return 
values, and actually compares the right object.

Modified Paths:
--------------
    trunk/phase3/tests/phpunit/includes/BlockTest.php

Modified: trunk/phase3/tests/phpunit/includes/BlockTest.php
===================================================================
--- trunk/phase3/tests/phpunit/includes/BlockTest.php   2011-06-16 17:38:26 UTC 
(rev 90218)
+++ trunk/phase3/tests/phpunit/includes/BlockTest.php   2011-06-16 17:58:26 UTC 
(rev 90219)
@@ -91,9 +91,14 @@
         * @dataProvider dataBug29116
         */
        function testBug29116LoadWithEmptyIp( $vagueTarget ) {
+               $uid = User::idFromName( 'UTBlockee' );
+               $this->assertTrue( ($uid > 0), 'Must be able to look up the 
target user during tests' );
+
                $block = new Block();
-               $block->load( $vagueTarget, 'UTBlockee' );
-               $this->assertTrue( $this->block->equals( 
Block::newFromTarget('UTBlockee', $vagueTarget) ), "Block->load() returns the 
same block as the one that was made when given empty ip param " . var_export( 
$vagueTarget, true ) );
+               $ok = $block->load( $vagueTarget, $uid );
+               $this->assertTrue( $ok, "Block->load() with empty IP and user 
ID '$uid' should return a block" );
+
+               $this->assertTrue( $this->block->equals( $block ), 
"Block->load() returns the same block as the one that was made when given empty 
ip param " . var_export( $vagueTarget, true ) );
        }
 
        /**


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to