diff --git a/tests/phpunit/NotifUserTest.php b/tests/phpunit/NotifUserTest.php index 6369df201..1c1908f3e 100644 --- a/tests/phpunit/NotifUserTest.php +++ b/tests/phpunit/NotifUserTest.php @@ -122,7 +122,7 @@ class MWEchoNotifUserTest extends MediaWikiTestCase { $gateway->expects( $this->any() ) ->method( 'getDB' ) ->will( $this->returnValue( - $this->getMockBuilder( Database::class ) + $this->getMockBuilder( IDatabase::class ) ->disableOriginalConstructor()->getMock() ) ); diff --git a/tests/phpunit/gateway/UserNotificationGatewayTest.php b/tests/phpunit/gateway/UserNotificationGatewayTest.php index b22721659..09c205347 100644 --- a/tests/phpunit/gateway/UserNotificationGatewayTest.php +++ b/tests/phpunit/gateway/UserNotificationGatewayTest.php @@ -106,9 +106,7 @@ class EchoUserNotificationGatewayTest extends MediaWikiTestCase { 'selectRow' => '', 'selectRowCount' => '', ]; - $db = $this->getMockBuilder( DatabaseMysqli::class ) - ->disableOriginalConstructor() - ->getMock(); + $db = $this->getMock( IDatabase::class ); $db->expects( $this->any() ) ->method( 'update' ) ->will( $this->returnValue( $dbResult['update'] ) ); diff --git a/tests/phpunit/mapper/EventMapperTest.php b/tests/phpunit/mapper/EventMapperTest.php index aefb627dd..344de7e12 100644 --- a/tests/phpunit/mapper/EventMapperTest.php +++ b/tests/phpunit/mapper/EventMapperTest.php @@ -103,9 +103,7 @@ class EchoEventMapperTest extends MediaWikiTestCase { 'select' => '', 'selectRow' => '' ]; - $db = $this->getMockBuilder( DatabaseMysqli::class ) - ->disableOriginalConstructor() - ->getMock(); + $db = $this->getMock( IDatabase::class ); $db->expects( $this->any() ) ->method( 'insert' ) ->will( $this->returnValue( $dbResult['insert'] ) ); diff --git a/tests/phpunit/mapper/NotificationMapperTest.php b/tests/phpunit/mapper/NotificationMapperTest.php index b16af1799..17cb1518d 100644 --- a/tests/phpunit/mapper/NotificationMapperTest.php +++ b/tests/phpunit/mapper/NotificationMapperTest.php @@ -128,9 +128,7 @@ class EchoNotificationMapperTest extends MediaWikiTestCase { public function testDeleteByUserEventOffset() { $this->setMwGlobals( [ 'wgUpdateRowsPerQuery' => 4 ] ); - $mockDb = $this->getMockBuilder( DatabaseMysqli::class ) - ->disableOriginalConstructor() - ->getMock(); + $mockDb = $this->getMock( IDatabase::class ); $mockDb->expects( $this->any() ) ->method( 'selectFieldValues' ) ->will( $this->returnValue( [ 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 ] ) ); @@ -153,7 +151,7 @@ class EchoNotificationMapperTest extends MediaWikiTestCase { $this->anything() ] ) - ->will( $this->returnValue( true ) ); + ->willReturn( true ); $notifMapper = new EchoNotificationMapper( $this->mockMWEchoDbFactory( $mockDb ) ); $this->assertTrue( $notifMapper->deleteByUserEventOffset( User::newFromId( 1 ), 500 ) ); @@ -221,9 +219,7 @@ class EchoNotificationMapperTest extends MediaWikiTestCase { 'delete' => '' ]; - $db = $this->getMockBuilder( DatabaseMysqli::class ) - ->disableOriginalConstructor() - ->getMock(); + $db = $this->getMock( IDatabase::class ); $db->expects( $this->any() ) ->method( 'insert' ) ->will( $this->returnValue( $dbResult['insert'] ) ); diff --git a/tests/phpunit/mapper/TargetPageMapperTest.php b/tests/phpunit/mapper/TargetPageMapperTest.php index 74ce6f950..34aa9ea25 100644 --- a/tests/phpunit/mapper/TargetPageMapperTest.php +++ b/tests/phpunit/mapper/TargetPageMapperTest.php @@ -74,9 +74,7 @@ class EchoTargetPageMapperTest extends MediaWikiTestCase { 'select' => '', 'delete' => '' ]; - $db = $this->getMockBuilder( DatabaseMysqli::class ) - ->disableOriginalConstructor() - ->getMock(); + $db = $this->getMock( IDatabase::class ); $db->expects( $this->any() ) ->method( 'insert' ) ->will( $this->returnValue( $dbResult['insert'] ) );