Merge "Mock IDatabase instead of DatabaseMysqli"

This commit is contained in:
jenkins-bot 2019-04-09 03:35:10 +00:00 committed by Gerrit Code Review
commit 755ac3f6c6
5 changed files with 7 additions and 17 deletions

View file

@ -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()
) );

View file

@ -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'] ) );

View file

@ -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'] ) );

View file

@ -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'] ) );

View file

@ -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'] ) );