Hoo man has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/102571


Change subject: Some sanity changes in EditEntityTest
......................................................................

Some sanity changes in EditEntityTest

Change-Id: Idba0262edd22a63955f4331371fec6dec45407f7
---
M repo/tests/phpunit/includes/EditEntityTest.php
1 file changed, 9 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/71/102571/1

diff --git a/repo/tests/phpunit/includes/EditEntityTest.php 
b/repo/tests/phpunit/includes/EditEntityTest.php
index 8940fce..ca12145 100644
--- a/repo/tests/phpunit/includes/EditEntityTest.php
+++ b/repo/tests/phpunit/includes/EditEntityTest.php
@@ -45,9 +45,8 @@
        }
 
        protected static function getTestRevisions() {
-               $user = self::getUser( "EditEntityTestUser2" );
-
                if ( self::$testRevisions === null ) {
+                       $user = self::getUser( "EditEntityTestUser2" );
                        $otherUser = self::getUser( "EditEntityTestUser2" );
 
                        $itemContent = ItemContent::newEmpty();
@@ -321,7 +320,8 @@
                // to get a concrete class to instantiate. Still note that our
                // test target is EntityContent::userWasLastToEdit.
                $anonUser = User::newFromId(0);
-               $sysopUser = User::newFromId(1);
+               $anonUser->setName( '127.0.0.1' );
+               $user = self::getUser( "EditEntityTestUser" );
                $itemContent = ItemContent::newEmpty();
 
                // check for default values, last revision by anon 
--------------------
@@ -333,7 +333,7 @@
 
                // check for default values, last revision by sysop 
--------------------
                $itemContent->getItem()->setLabel( 'en', "Test SysOp default" );
-               $status = $itemContent->save( 'testedit for sysop', $sysopUser, 
EDIT_UPDATE );
+               $status = $itemContent->save( 'testedit for sysop', $user, 
EDIT_UPDATE );
                $this->assertTrue( $status->isGood() );
                $res = EditEntity::userWasLastToEdit( false, false );
                $this->assertFalse( $res );
@@ -347,9 +347,9 @@
 
                // check for default values, last revision by sysop 
--------------------
                $itemContent->getItem()->setLabel( 'en', "Test SysOp with user" 
);
-               $status = $itemContent->save( 'testedit for sysop', $sysopUser, 
EDIT_UPDATE );
+               $status = $itemContent->save( 'testedit for sysop', $user, 
EDIT_UPDATE );
                $this->assertTrue( $status->isGood() );
-               $res = EditEntity::userWasLastToEdit( $sysopUser->getId(), 
false );
+               $res = EditEntity::userWasLastToEdit( $user->getId(), false );
                $this->assertFalse( $res );
 
                // create an edit and check if the anon user is last to edit 
--------------------
@@ -361,16 +361,16 @@
                $res = EditEntity::userWasLastToEdit( $anonUser->getId(), 
$lastRevId );
                $this->assertTrue( $res );
                // also check that there is a failure if we use the sysop user
-               $res = EditEntity::userWasLastToEdit( $sysopUser->getId(), 
$lastRevId );
+               $res = EditEntity::userWasLastToEdit( $user->getId(), 
$lastRevId );
                $this->assertFalse( $res );
 
                // create an edit and check if the sysop user is last to edit 
--------------------
                $page = $itemContent->getWikiPage();
                $lastRevId = $page->getRevision()->getId();
                $itemContent->getItem()->setLabel( 'en', "Test SysOp" );
-               $status = $itemContent->save( 'testedit for sysop', $sysopUser, 
EDIT_UPDATE );
+               $status = $itemContent->save( 'testedit for sysop', $user, 
EDIT_UPDATE );
                $this->assertTrue( $status->isGood() );
-               $res = EditEntity::userWasLastToEdit( $sysopUser->getId(), 
$lastRevId );
+               $res = EditEntity::userWasLastToEdit( $user->getId(), 
$lastRevId );
                $this->assertTrue( $res );
                // also check that there is a failure if we use the anon user
                $res = EditEntity::userWasLastToEdit( $anonUser->getId(), 
$lastRevId );

-- 
To view, visit https://gerrit.wikimedia.org/r/102571
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idba0262edd22a63955f4331371fec6dec45407f7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>

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

Reply via email to