jenkins-bot has submitted this change and it was merged.

Change subject: Fix PHPUnit tests
......................................................................


Fix PHPUnit tests

* Make LoggedInUser more of a value object (before, it was still using
  the real getId/setId, which broke on Jenkins)
* Remove stray WSTimestamp (typo, and unneeded anyway)
* Put expected before actual (as PHPUnit documents it), and add message.
  This doesn't affect the results if it passes, but makes the message
  more accurate and helpful on failure.

Change-Id: Ieeec7ef1173698956491579f7479afec2d5e86ce
---
M tests/phpunit/TaskRecommendationsExperimentV1Test.php
M tests/phpunit/mocks/LoggedInUser.php
2 files changed, 13 insertions(+), 3 deletions(-)

Approvals:
  Phuedx: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/phpunit/TaskRecommendationsExperimentV1Test.php 
b/tests/phpunit/TaskRecommendationsExperimentV1Test.php
index 9cea4b5..8ca2c43 100644
--- a/tests/phpunit/TaskRecommendationsExperimentV1Test.php
+++ b/tests/phpunit/TaskRecommendationsExperimentV1Test.php
@@ -78,8 +78,8 @@
                $user = $this->getLoggedInNewUser();
                $user->setId( $userId );
                $experiment = new TaskRecommendationsExperimentV1( $user );
-               $this->assertEquals( $experiment->isPostEditEnabled(), 
$shouldSeePostEditNotification );
-               $this->assertEquals( $experiment->isFlyoutEnabled(), 
$shouldSeeFlyout );
+               $this->assertEquals( $shouldSeePostEditNotification, 
$experiment->isPostEditEnabled(), 'isPostEditEnabled' );
+               $this->assertEquals( $shouldSeeFlyout, 
$experiment->isFlyoutEnabled(), 'isFlyoutEnabled' );
        }
 
        private function getLoggedInOldUser() {
diff --git a/tests/phpunit/mocks/LoggedInUser.php 
b/tests/phpunit/mocks/LoggedInUser.php
index eaf46a0..8eb0b0a 100644
--- a/tests/phpunit/mocks/LoggedInUser.php
+++ b/tests/phpunit/mocks/LoggedInUser.php
@@ -2,11 +2,13 @@
 
 namespace Tests\GettingStarted\Mocks;
 
-use User, WSTimestamp;
+use User;
 
 class LoggedInUser extends User {
 
        private $registration;
+
+       private $id;
 
        /**
         * Constructs a mock user and sets the timestamp field in the correct 
format
@@ -26,4 +28,12 @@
        public function getRegistration() {
                return $this->registration;
        }
+
+       public function setId( $id ) {
+               $this->id = $id;
+       }
+
+       public function getId() {
+               return $this->id;
+       }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ieeec7ef1173698956491579f7479afec2d5e86ce
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/GettingStarted
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>
Gerrit-Reviewer: Phuedx <[email protected]>
Gerrit-Reviewer: Robmoen <[email protected]>
Gerrit-Reviewer: Swalling <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to