From b708ba246247d63fe612253bd071dccb922a3f0e Mon Sep 17 00:00:00 2001 From: DannyS712 Date: Fri, 2 Oct 2020 03:40:58 +0000 Subject: [PATCH] UserNotificationGatewayTest: Mock User objects Since its a unit test, the use of User::newFromId prevents attempts in core to migrate to the UserFactory. Change-Id: If5e76f2ae570ef4ae58cb77b5281c4446a1cadff --- .../unit/gateway/UserNotificationGatewayTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/phpunit/unit/gateway/UserNotificationGatewayTest.php b/tests/phpunit/unit/gateway/UserNotificationGatewayTest.php index 2f45ee2fe..8e5a9232d 100644 --- a/tests/phpunit/unit/gateway/UserNotificationGatewayTest.php +++ b/tests/phpunit/unit/gateway/UserNotificationGatewayTest.php @@ -10,7 +10,7 @@ class EchoUserNotificationGatewayTest extends MediaWikiUnitTestCase { public function testMarkRead() { // no event ids to mark $gateway = new EchoUserNotificationGateway( - User::newFromId( 1 ), + $this->mockUser(), $this->mockMWEchoDbFactory(), $this->mockConfig() ); @@ -18,7 +18,7 @@ class EchoUserNotificationGatewayTest extends MediaWikiUnitTestCase { // successful update $gateway = new EchoUserNotificationGateway( - User::newFromId( 1 ), + $this->mockUser(), $this->mockMWEchoDbFactory( [ 'update' => true ] ), $this->mockConfig() ); @@ -26,7 +26,7 @@ class EchoUserNotificationGatewayTest extends MediaWikiUnitTestCase { // unsuccessful update $gateway = new EchoUserNotificationGateway( - User::newFromId( 1 ), + $this->mockUser(), $this->mockMWEchoDbFactory( [ 'update' => false ] ), $this->mockConfig() ); @@ -36,7 +36,7 @@ class EchoUserNotificationGatewayTest extends MediaWikiUnitTestCase { public function testMarkAllRead() { // successful update $gateway = new EchoUserNotificationGateway( - User::newFromId( 1 ), + $this->mockUser(), $this->mockMWEchoDbFactory( [ 'update' => true ] ), $this->mockConfig() ); @@ -44,7 +44,7 @@ class EchoUserNotificationGatewayTest extends MediaWikiUnitTestCase { // null update $gateway = new EchoUserNotificationGateway( - User::newFromId( 1 ), + $this->mockUser(), $this->mockMWEchoDbFactory( [ 'update' => false ] ), $this->mockConfig() );