mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-09-25 03:09:37 +00:00
Merge "Mock IDatabase instead of DatabaseMysqli"
This commit is contained in:
commit
755ac3f6c6
|
@ -122,7 +122,7 @@ class MWEchoNotifUserTest extends MediaWikiTestCase {
|
||||||
$gateway->expects( $this->any() )
|
$gateway->expects( $this->any() )
|
||||||
->method( 'getDB' )
|
->method( 'getDB' )
|
||||||
->will( $this->returnValue(
|
->will( $this->returnValue(
|
||||||
$this->getMockBuilder( Database::class )
|
$this->getMockBuilder( IDatabase::class )
|
||||||
->disableOriginalConstructor()->getMock()
|
->disableOriginalConstructor()->getMock()
|
||||||
) );
|
) );
|
||||||
|
|
||||||
|
|
|
@ -106,9 +106,7 @@ class EchoUserNotificationGatewayTest extends MediaWikiTestCase {
|
||||||
'selectRow' => '',
|
'selectRow' => '',
|
||||||
'selectRowCount' => '',
|
'selectRowCount' => '',
|
||||||
];
|
];
|
||||||
$db = $this->getMockBuilder( DatabaseMysqli::class )
|
$db = $this->getMock( IDatabase::class );
|
||||||
->disableOriginalConstructor()
|
|
||||||
->getMock();
|
|
||||||
$db->expects( $this->any() )
|
$db->expects( $this->any() )
|
||||||
->method( 'update' )
|
->method( 'update' )
|
||||||
->will( $this->returnValue( $dbResult['update'] ) );
|
->will( $this->returnValue( $dbResult['update'] ) );
|
||||||
|
|
|
@ -103,9 +103,7 @@ class EchoEventMapperTest extends MediaWikiTestCase {
|
||||||
'select' => '',
|
'select' => '',
|
||||||
'selectRow' => ''
|
'selectRow' => ''
|
||||||
];
|
];
|
||||||
$db = $this->getMockBuilder( DatabaseMysqli::class )
|
$db = $this->getMock( IDatabase::class );
|
||||||
->disableOriginalConstructor()
|
|
||||||
->getMock();
|
|
||||||
$db->expects( $this->any() )
|
$db->expects( $this->any() )
|
||||||
->method( 'insert' )
|
->method( 'insert' )
|
||||||
->will( $this->returnValue( $dbResult['insert'] ) );
|
->will( $this->returnValue( $dbResult['insert'] ) );
|
||||||
|
|
|
@ -128,9 +128,7 @@ class EchoNotificationMapperTest extends MediaWikiTestCase {
|
||||||
|
|
||||||
public function testDeleteByUserEventOffset() {
|
public function testDeleteByUserEventOffset() {
|
||||||
$this->setMwGlobals( [ 'wgUpdateRowsPerQuery' => 4 ] );
|
$this->setMwGlobals( [ 'wgUpdateRowsPerQuery' => 4 ] );
|
||||||
$mockDb = $this->getMockBuilder( DatabaseMysqli::class )
|
$mockDb = $this->getMock( IDatabase::class );
|
||||||
->disableOriginalConstructor()
|
|
||||||
->getMock();
|
|
||||||
$mockDb->expects( $this->any() )
|
$mockDb->expects( $this->any() )
|
||||||
->method( 'selectFieldValues' )
|
->method( 'selectFieldValues' )
|
||||||
->will( $this->returnValue( [ 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 ] ) );
|
->will( $this->returnValue( [ 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 ] ) );
|
||||||
|
@ -153,7 +151,7 @@ class EchoNotificationMapperTest extends MediaWikiTestCase {
|
||||||
$this->anything()
|
$this->anything()
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
->will( $this->returnValue( true ) );
|
->willReturn( true );
|
||||||
|
|
||||||
$notifMapper = new EchoNotificationMapper( $this->mockMWEchoDbFactory( $mockDb ) );
|
$notifMapper = new EchoNotificationMapper( $this->mockMWEchoDbFactory( $mockDb ) );
|
||||||
$this->assertTrue( $notifMapper->deleteByUserEventOffset( User::newFromId( 1 ), 500 ) );
|
$this->assertTrue( $notifMapper->deleteByUserEventOffset( User::newFromId( 1 ), 500 ) );
|
||||||
|
@ -221,9 +219,7 @@ class EchoNotificationMapperTest extends MediaWikiTestCase {
|
||||||
'delete' => ''
|
'delete' => ''
|
||||||
];
|
];
|
||||||
|
|
||||||
$db = $this->getMockBuilder( DatabaseMysqli::class )
|
$db = $this->getMock( IDatabase::class );
|
||||||
->disableOriginalConstructor()
|
|
||||||
->getMock();
|
|
||||||
$db->expects( $this->any() )
|
$db->expects( $this->any() )
|
||||||
->method( 'insert' )
|
->method( 'insert' )
|
||||||
->will( $this->returnValue( $dbResult['insert'] ) );
|
->will( $this->returnValue( $dbResult['insert'] ) );
|
||||||
|
|
|
@ -74,9 +74,7 @@ class EchoTargetPageMapperTest extends MediaWikiTestCase {
|
||||||
'select' => '',
|
'select' => '',
|
||||||
'delete' => ''
|
'delete' => ''
|
||||||
];
|
];
|
||||||
$db = $this->getMockBuilder( DatabaseMysqli::class )
|
$db = $this->getMock( IDatabase::class );
|
||||||
->disableOriginalConstructor()
|
|
||||||
->getMock();
|
|
||||||
$db->expects( $this->any() )
|
$db->expects( $this->any() )
|
||||||
->method( 'insert' )
|
->method( 'insert' )
|
||||||
->will( $this->returnValue( $dbResult['insert'] ) );
|
->will( $this->returnValue( $dbResult['insert'] ) );
|
||||||
|
|
Loading…
Reference in a new issue