X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles_versions%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FBlockTest.php;h=2a2b6035653127bc9326b9ddccc185e86816ef2b;hb=4b72ec94d1db804aceb5fd25c5e808f5524f5d18;hp=e69fa200c6f5c76ce59282aeba0a86302999689f;hpb=91d69e12e1d2e00953cae3c153e37f3d36e5903c;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/BlockTest.php b/tests/phpunit/includes/BlockTest.php index e69fa200c6..2a2b603565 100644 --- a/tests/phpunit/includes/BlockTest.php +++ b/tests/phpunit/includes/BlockTest.php @@ -136,8 +136,9 @@ class BlockTest extends MediaWikiLangTestCase { public function testBlockedUserCanNotCreateAccount() { $username = 'BlockedUserToCreateAccountWith'; $u = User::newFromName( $username ); - $u->setId( 14146 ); $u->addToDatabase(); + $userId = $u->getId(); + $this->assertNotEquals( 0, $userId, 'sanity' ); TestUser::setPasswordForUser( $u, 'NotRandomPass' ); unset( $u ); @@ -157,7 +158,7 @@ class BlockTest extends MediaWikiLangTestCase { // Foreign perspective (blockee not on current wiki)... $blockOptions = array( 'address' => $username, - 'user' => 14146, + 'user' => $userId, 'reason' => 'crosswiki block...', 'timestamp' => wfTimestampNow(), 'expiry' => $this->db->getInfinity(), @@ -205,13 +206,13 @@ class BlockTest extends MediaWikiLangTestCase { // Local perspective (blockee on current wiki)... $user = User::newFromName( 'UserOnForeignWiki' ); $user->addToDatabase(); - // Set user ID to match the test value - $this->db->update( 'user', array( 'user_id' => 14146 ), array( 'user_id' => $user->getId() ) ); + $userId = $user->getId(); + $this->assertNotEquals( 0, $userId, 'sanity' ); // Foreign perspective (blockee not on current wiki)... $blockOptions = array( 'address' => 'UserOnForeignWiki', - 'user' => 14146, + 'user' => $user->getId(), 'reason' => 'crosswiki block...', 'timestamp' => wfTimestampNow(), 'expiry' => $this->db->getInfinity(), @@ -234,7 +235,7 @@ class BlockTest extends MediaWikiLangTestCase { $block->getTarget()->getName(), 'Correct blockee name' ); - $this->assertEquals( '14146', $block->getTarget()->getId(), 'Correct blockee id' ); + $this->assertEquals( $userId, $block->getTarget()->getId(), 'Correct blockee id' ); $this->assertEquals( 'MetaWikiUser', $block->getBlocker(), 'Correct blocker name' ); $this->assertEquals( 'MetaWikiUser', $block->getByName(), 'Correct blocker name' ); $this->assertEquals( 0, $block->getBy(), 'Correct blocker id' );