saper has uploaded a new change for review.
https://gerrit.wikimedia.org/r/100334
Change subject: Let BlockTest.php respect database constraints
......................................................................
Let BlockTest.php respect database constraints
This is an attempt to make BlockTest not to fail
with database referential constraints enabled
(from I326bb4a189bf881299b9fb678033a927b916efac)
Bug: 58191
Change-Id: I45c2d466f77d4d0aa25e880b5bb7d1120c39a561
---
M tests/phpunit/includes/BlockTest.php
1 file changed, 7 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/34/100334/1
diff --git a/tests/phpunit/includes/BlockTest.php
b/tests/phpunit/includes/BlockTest.php
index f0049fe..dafdfdc 100644
--- a/tests/phpunit/includes/BlockTest.php
+++ b/tests/phpunit/includes/BlockTest.php
@@ -141,6 +141,7 @@
$username = 'BlockedUserToCreateAccountWith';
$u = User::newFromName( $username );
$u->setPassword( 'NotRandomPass' );
+ $u->setId( 14146 );
$u->addToDatabase();
unset( $u );
@@ -208,6 +209,12 @@
$oldBlock->delete();
}
+ // 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() ) );
+
// Foreign perspective (blockee not on current wiki)...
$block = new Block(
/* $address */ 'UserOnForeignWiki',
@@ -229,11 +236,6 @@
$res = $block->insert( $this->db );
$this->assertTrue( (bool)$res['id'], 'Block succeeded' );
- // 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() ) );
$user = null; // clear
$block = Block::newFromID( $res['id'] );
--
To view, visit https://gerrit.wikimedia.org/r/100334
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I45c2d466f77d4d0aa25e880b5bb7d1120c39a561
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: saper <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits