mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-09-23 10:22:05 +00:00
tests: Replace assertEmpty with assertSame
assertSame avoids use of loose comparisons and allows to check the expected type Change-Id: I7220be39f824226f55d966474b58ac12491910a3
This commit is contained in:
parent
d7fde11f16
commit
bb6cb2de0b
|
@ -7,7 +7,6 @@
|
|||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
|
||||
<exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" />
|
||||
<exclude name="MediaWiki.PHPUnit.AssertEmpty.AssertEmptyUsed" />
|
||||
</rule>
|
||||
<arg name="encoding" value="UTF-8" />
|
||||
<arg name="extensions" value="php" />
|
||||
|
|
|
@ -20,7 +20,7 @@ class NotificationMapperTest extends MediaWikiIntegrationTestCase {
|
|||
// Unsuccessful select
|
||||
$notifMapper = new NotificationMapper( $this->mockMWEchoDbFactory( [ 'select' => false ] ) );
|
||||
$res = $notifMapper->fetchUnreadByUser( $this->mockUser(), 10, null, '' );
|
||||
$this->assertEmpty( $res );
|
||||
$this->assertSame( [], $res );
|
||||
|
||||
// Successful select
|
||||
$dbResult = [
|
||||
|
@ -40,7 +40,7 @@ class NotificationMapperTest extends MediaWikiIntegrationTestCase {
|
|||
];
|
||||
$notifMapper = new NotificationMapper( $this->mockMWEchoDbFactory( [ 'select' => $dbResult ] ) );
|
||||
$res = $notifMapper->fetchUnreadByUser( $this->mockUser(), 10, null, '', [] );
|
||||
$this->assertEmpty( $res );
|
||||
$this->assertSame( [], $res );
|
||||
|
||||
$notifMapper = new NotificationMapper( $this->mockMWEchoDbFactory( [ 'select' => $dbResult ] ) );
|
||||
$res = $notifMapper->fetchUnreadByUser( $this->mockUser(), 10, null, '', [ 'test_event' ] );
|
||||
|
@ -55,7 +55,7 @@ class NotificationMapperTest extends MediaWikiIntegrationTestCase {
|
|||
// Unsuccessful select
|
||||
$notifMapper = new NotificationMapper( $this->mockMWEchoDbFactory( [ 'select' => false ] ) );
|
||||
$res = $notifMapper->fetchByUser( $this->mockUser(), 10, '' );
|
||||
$this->assertEmpty( $res );
|
||||
$this->assertSame( [], $res );
|
||||
|
||||
// Successful select
|
||||
$notifDbResult = [
|
||||
|
@ -77,7 +77,7 @@ class NotificationMapperTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$notifMapper = new NotificationMapper( $this->mockMWEchoDbFactory( [ 'select' => $notifDbResult ] ) );
|
||||
$res = $notifMapper->fetchByUser( $this->mockUser(), 10, '', [] );
|
||||
$this->assertEmpty( $res );
|
||||
$this->assertSame( [], $res );
|
||||
|
||||
$notifMapper = new NotificationMapper(
|
||||
$this->mockMWEchoDbFactory( [ 'select' => $notifDbResult ] )
|
||||
|
@ -91,7 +91,7 @@ class NotificationMapperTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$notifMapper = new NotificationMapper( $this->mockMWEchoDbFactory( [] ) );
|
||||
$res = $notifMapper->fetchByUser( $this->mockUser(), 10, '' );
|
||||
$this->assertEmpty( $res );
|
||||
$this->assertSame( [], $res );
|
||||
}
|
||||
|
||||
public function testFetchByUserOffset() {
|
||||
|
|
|
@ -92,7 +92,7 @@ class UserNotificationGatewayTest extends MediaWikiUnitTestCase {
|
|||
$this->mockMWEchoDbFactory( [ 'select' => false ] ),
|
||||
$this->mockConfig()
|
||||
);
|
||||
$this->assertEmpty( $gateway->getUnreadNotifications( 'user_talk' ) );
|
||||
$this->assertSame( [], $gateway->getUnreadNotifications( 'user_talk' ) );
|
||||
|
||||
$dbResult = [
|
||||
(object)[ 'notification_event' => 1 ],
|
||||
|
|
Loading…
Reference in a new issue