Merge "Avoid use of IDatabase::update return value"

This commit is contained in:
jenkins-bot 2018-10-26 23:39:32 +00:00 committed by Gerrit Code Review
commit f84c49a9f9
2 changed files with 5 additions and 3 deletions

View file

@ -122,7 +122,7 @@ class EchoUserNotificationGateway {
return false; return false;
} }
return $dbw->update( $dbw->update(
self::$notificationTable, self::$notificationTable,
[ 'notification_read_timestamp' => $dbw->timestamp( wfTimestampNow() ) ], [ 'notification_read_timestamp' => $dbw->timestamp( wfTimestampNow() ) ],
[ [
@ -131,6 +131,8 @@ class EchoUserNotificationGateway {
], ],
__METHOD__ __METHOD__
); );
return true;
} }
/** /**

View file

@ -24,9 +24,9 @@ class EchoUserNotificationGatewayTest extends MediaWikiTestCase {
$gateway = new EchoUserNotificationGateway( User::newFromId( 1 ), $this->mockMWEchoDbFactory( [ 'update' => true ] ) ); $gateway = new EchoUserNotificationGateway( User::newFromId( 1 ), $this->mockMWEchoDbFactory( [ 'update' => true ] ) );
$this->assertTrue( $gateway->markAllRead( [ 2 ] ) ); $this->assertTrue( $gateway->markAllRead( [ 2 ] ) );
// unsuccessful update // null update
$gateway = new EchoUserNotificationGateway( User::newFromId( 1 ), $this->mockMWEchoDbFactory( [ 'update' => false ] ) ); $gateway = new EchoUserNotificationGateway( User::newFromId( 1 ), $this->mockMWEchoDbFactory( [ 'update' => false ] ) );
$this->assertFalse( $gateway->markAllRead( [ 2 ] ) ); $this->assertTrue( $gateway->markAllRead( [ 2 ] ) );
} }
public function testGetNotificationCount() { public function testGetNotificationCount() {