diff --git a/.phpcs.xml b/.phpcs.xml
index 3bbdd2be5ef..f0e8dee2007 100644
--- a/.phpcs.xml
+++ b/.phpcs.xml
@@ -13,7 +13,6 @@
-
diff --git a/tests/phpunit/includes/HtmlTest.php b/tests/phpunit/includes/HtmlTest.php
index 2f89176e10b..996d02574f2 100644
--- a/tests/phpunit/includes/HtmlTest.php
+++ b/tests/phpunit/includes/HtmlTest.php
@@ -196,7 +196,7 @@ class HtmlTest extends MediaWikiIntegrationTestCase {
* @dataProvider provideExpandAttributesEmpty
*/
public function testExpandAttributesEmpty( array $attribs ) {
- $this->assertEmpty( Html::expandAttributes( $attribs ) );
+ $this->assertSame( '', Html::expandAttributes( $attribs ) );
}
public function provideExpandAttributesClass() {
diff --git a/tests/phpunit/includes/Permissions/PermissionManagerTest.php b/tests/phpunit/includes/Permissions/PermissionManagerTest.php
index d486dc2af08..5e7c8d35276 100644
--- a/tests/phpunit/includes/Permissions/PermissionManagerTest.php
+++ b/tests/phpunit/includes/Permissions/PermissionManagerTest.php
@@ -414,7 +414,7 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
$this->overrideUserPermissions( $this->user, [ 'edit' ] );
- $this->assertEmpty( $permissionManager->getPermissionErrors( 'edit', $this->user, $title ) );
+ $this->assertSame( [], $permissionManager->getPermissionErrors( 'edit', $this->user, $title ) );
$this->assertTrue( $permissionManager->userCan( 'edit', $this->user, $title ) );
}
@@ -444,7 +444,8 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
$title
)
);
- $this->assertEmpty(
+ $this->assertSame(
+ [],
$permissionManager->getPermissionErrors(
'edit',
$user,
diff --git a/tests/phpunit/includes/Revision/ContributionsLookupTest.php b/tests/phpunit/includes/Revision/ContributionsLookupTest.php
index 0e76ca440fe..a78f097c235 100644
--- a/tests/phpunit/includes/Revision/ContributionsLookupTest.php
+++ b/tests/phpunit/includes/Revision/ContributionsLookupTest.php
@@ -242,7 +242,7 @@ class ContributionsLookupTest extends MediaWikiIntegrationTestCase {
$segment0 =
$contributionsLookup->getContributions( $target, 10, self::$performer, '', 'not-a-tag' );
- $this->assertEmpty( $segment0->getRevisions() );
+ $this->assertSame( [], $segment0->getRevisions() );
}
/**
diff --git a/tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php b/tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php
index 72261661f92..abb9cc55d34 100644
--- a/tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php
+++ b/tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php
@@ -641,7 +641,7 @@ class DerivedPageDataUpdaterTest extends MediaWikiIntegrationTestCase {
$dataUpdates = $updater->getSecondaryDataUpdates();
- $this->assertEmpty( $dataUpdates );
+ $this->assertSame( [], $dataUpdates );
}
/**
diff --git a/tests/phpunit/includes/TitleTest.php b/tests/phpunit/includes/TitleTest.php
index 36c4e754748..87e8dda4e39 100644
--- a/tests/phpunit/includes/TitleTest.php
+++ b/tests/phpunit/includes/TitleTest.php
@@ -2257,7 +2257,7 @@ class TitleTest extends MediaWikiIntegrationTestCase {
$this->getExistingTestPage( $title->getSubpage( 'A' ) );
$this->getExistingTestPage( $title->getSubpage( 'B' ) );
- $this->assertEmpty( $title->getSubpages() );
+ $this->assertSame( [], $title->getSubpages() );
}
public function provideNamespaces() {
diff --git a/tests/phpunit/includes/changes/RecentChangeTest.php b/tests/phpunit/includes/changes/RecentChangeTest.php
index 85e777fad9c..650798f5b63 100644
--- a/tests/phpunit/includes/changes/RecentChangeTest.php
+++ b/tests/phpunit/includes/changes/RecentChangeTest.php
@@ -542,7 +542,7 @@ class RecentChangeTest extends MediaWikiIntegrationTestCase {
$errors = $rc->doMarkPatrolled(
$this->mockUserAuthorityWithPermissions( $this->user, [ 'patrol', 'autopatrol' ] )
);
- $this->assertEmpty( $errors );
+ $this->assertSame( [], $errors );
$reloadedRC = RecentChange::newFromId( $rc->getAttribute( 'rc_id' ) );
$this->assertSame( '1', $reloadedRC->getAttribute( 'rc_patrolled' ) );
diff --git a/tests/phpunit/includes/filebackend/FileBackendGroupIntegrationTest.php b/tests/phpunit/includes/filebackend/FileBackendGroupIntegrationTest.php
index 395c056e5c1..89feb5fd9b3 100644
--- a/tests/phpunit/includes/filebackend/FileBackendGroupIntegrationTest.php
+++ b/tests/phpunit/includes/filebackend/FileBackendGroupIntegrationTest.php
@@ -44,7 +44,7 @@ class FileBackendGroupIntegrationTest extends MediaWikiIntegrationTestCase {
}
}
- $this->assertEmpty(
+ $this->assertSame( [],
array_diff( array_keys( $options ), $globals, array_keys( $serviceMembers ) ) );
$services = $this->getServiceContainer();
diff --git a/tests/phpunit/includes/page/PageStoreTest.php b/tests/phpunit/includes/page/PageStoreTest.php
index 11c0e4ffe00..69b077df3dd 100644
--- a/tests/phpunit/includes/page/PageStoreTest.php
+++ b/tests/phpunit/includes/page/PageStoreTest.php
@@ -764,7 +764,7 @@ class PageStoreTest extends MediaWikiIntegrationTestCase {
$this->getExistingTestPage( $title->getSubpage( 'B' ) );
$pageStore = $this->getPageStore();
- $this->assertEmpty( $pageStore->getSubpages( $title, 100 ) );
+ $this->assertCount( 0, $pageStore->getSubpages( $title, 100 ) );
}
/**
diff --git a/tests/phpunit/includes/user/UserGroupManagerTest.php b/tests/phpunit/includes/user/UserGroupManagerTest.php
index 0931f2b7053..439b7696bd9 100644
--- a/tests/phpunit/includes/user/UserGroupManagerTest.php
+++ b/tests/phpunit/includes/user/UserGroupManagerTest.php
@@ -376,7 +376,7 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase {
$manager = $this->getManager();
$anon = new UserIdentityValue( 0, 'Anon' );
- $this->assertEmpty( $manager->getUserGroupMemberships( $anon ) );
+ $this->assertSame( [], $manager->getUserGroupMemberships( $anon ) );
}
/**
@@ -386,7 +386,7 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase {
$manager = $this->getManager();
$anon = new UserIdentityValue( 0, 'Anon' );
- $this->assertEmpty( $manager->getUserFormerGroups( $anon ) );
+ $this->assertSame( [], $manager->getUserFormerGroups( $anon ) );
}
/**
@@ -837,7 +837,7 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase {
'GetAutoPromoteGroups',
function ( User $hookUser, array &$promote ) use ( $user ){
$this->assertTrue( $user->equals( $hookUser ) );
- $this->assertEmpty( $promote );
+ $this->assertSame( [], $promote );
$promote[] = 'from_hook';
}
);
@@ -859,16 +859,16 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase {
]
]
] );
- $this->assertEmpty( $manager->getUserAutopromoteGroups(
+ $this->assertSame( [], $manager->getUserAutopromoteGroups(
$this->getTestUser( [ 'group1' ] )->getUser() )
);
- $this->assertEmpty( $manager->getUserAutopromoteGroups(
+ $this->assertSame( [], $manager->getUserAutopromoteGroups(
$this->getTestUser( [ 'group1', 'group2' ] )->getUser() )
);
- $this->assertEmpty( $manager->getUserAutopromoteGroups(
+ $this->assertSame( [], $manager->getUserAutopromoteGroups(
$this->getTestUser( [ 'group1', 'group3', 'group4' ] )->getUser() )
);
- $this->assertEmpty( $manager->getUserAutopromoteGroups(
+ $this->assertSame( [], $manager->getUserAutopromoteGroups(
$this->getTestUser( [ 'group1', 'group3' ] )->getUser() )
);
$this->assertArrayEquals(
@@ -886,7 +886,7 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase {
'Autopromote' => [ 'test_autoconfirmed' => [ APCOND_ISBOT ] ]
] );
$notBot = $this->getTestUser()->getUser();
- $this->assertEmpty( $manager->getUserAutopromoteGroups( $notBot ) );
+ $this->assertSame( [], $manager->getUserAutopromoteGroups( $notBot ) );
$bot = $this->getTestUser( [ 'bot' ] )->getUser();
$this->assertArrayEquals( [ 'test_autoconfirmed' ],
$manager->getUserAutopromoteGroups( $bot ) );
@@ -901,7 +901,7 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase {
'Autopromote' => [ 'test_autoconfirmed' => [ APCOND_BLOCKED ] ]
] );
$nonBlockedUser = $this->getTestUser()->getUser();
- $this->assertEmpty( $manager->getUserAutopromoteGroups( $nonBlockedUser ) );
+ $this->assertSame( [], $manager->getUserAutopromoteGroups( $nonBlockedUser ) );
$blockedUser = $this->getTestUser( [ 'blocked' ] )->getUser();
$block = new DatabaseBlock();
$block->setTarget( $blockedUser );
@@ -948,7 +948,7 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase {
$sc = RequestContext::importScopedSession( $sinfo ); // load new context
$info = $context->exportSession();
- $this->assertEmpty( $user->getBlock() );
+ $this->assertNull( $user->getBlock() );
}
/**
@@ -1044,7 +1044,7 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase {
->getUserGroupManager( 'TEST_DOMAIN' );
$user = $this->getTestUser()->getUser();
$this->expectException( PreconditionException::class );
- $this->assertEmpty( $manager->addUserToAutopromoteOnceGroups( $user, 'TEST' ) );
+ $this->assertSame( [], $manager->addUserToAutopromoteOnceGroups( $user, 'TEST' ) );
}
/**
@@ -1053,7 +1053,7 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase {
public function testAddUserToAutopromoteOnceGroupsAnon() {
$manager = $this->getManager();
$anon = new UserIdentityValue( 0, 'TEST' );
- $this->assertEmpty( $manager->addUserToAutopromoteOnceGroups( $anon, 'TEST' ) );
+ $this->assertSame( [], $manager->addUserToAutopromoteOnceGroups( $anon, 'TEST' ) );
}
/**
@@ -1063,7 +1063,7 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase {
$manager = $this->getManager();
$user = $this->getTestUser()->getUser();
$this->getServiceContainer()->getConfiguredReadOnlyMode()->setReason( 'TEST' );
- $this->assertEmpty( $manager->addUserToAutopromoteOnceGroups( $user, 'TEST' ) );
+ $this->assertSame( [], $manager->addUserToAutopromoteOnceGroups( $user, 'TEST' ) );
}
/**
@@ -1072,7 +1072,7 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase {
public function testAddUserToAutopromoteOnceGroupsNoGroups() {
$manager = $this->getManager();
$user = $this->getTestUser()->getUser();
- $this->assertEmpty( $manager->addUserToAutopromoteOnceGroups( $user, 'TEST' ) );
+ $this->assertSame( [], $manager->addUserToAutopromoteOnceGroups( $user, 'TEST' ) );
}
/**
@@ -1090,7 +1090,7 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase {
function ( User $hookUser, array $added, array $removed ) use ( $user, &$hookCalled ) {
$this->assertTrue( $user->equals( $hookUser ) );
$this->assertArrayEquals( [ 'autopromoteonce' ], $added );
- $this->assertEmpty( $removed );
+ $this->assertSame( [], $removed );
$hookCalled = true;
}
);
diff --git a/tests/phpunit/unit/includes/Permissions/PermissionStatusTest.php b/tests/phpunit/unit/includes/Permissions/PermissionStatusTest.php
index 4fe06b13499..e5aa4e5a6eb 100644
--- a/tests/phpunit/unit/includes/Permissions/PermissionStatusTest.php
+++ b/tests/phpunit/unit/includes/Permissions/PermissionStatusTest.php
@@ -34,7 +34,7 @@ class PermissionStatusTest extends MediaWikiUnitTestCase {
$this->assertStatusOK( $status );
$this->assertStatusGood( $status );
- $this->assertEmpty( $status->getErrors() );
+ $this->assertSame( [], $status->getErrors() );
}
public function testBlock() {
diff --git a/tests/phpunit/unit/includes/Rest/Handler/HandlerTest.php b/tests/phpunit/unit/includes/Rest/Handler/HandlerTest.php
index e96d53fe1d4..e1f8d724bff 100644
--- a/tests/phpunit/unit/includes/Rest/Handler/HandlerTest.php
+++ b/tests/phpunit/unit/includes/Rest/Handler/HandlerTest.php
@@ -386,8 +386,8 @@ class HandlerTest extends \MediaWikiUnitTestCase {
$response = new Response();
$handler->applyConditionalResponseHeaders( $response );
- $this->assertEmpty( $response->getHeaderLine( 'ETag' ) );
- $this->assertEmpty( $response->getHeaderLine( 'Last-Modified' ) );
+ $this->assertSame( '', $response->getHeaderLine( 'ETag' ) );
+ $this->assertSame( '', $response->getHeaderLine( 'Last-Modified' ) );
}
public function provideCacheControl() {
diff --git a/tests/phpunit/unit/includes/libs/DnsSrvDiscovererTest.php b/tests/phpunit/unit/includes/libs/DnsSrvDiscovererTest.php
index 4cba59f47ef..67365d8c00a 100644
--- a/tests/phpunit/unit/includes/libs/DnsSrvDiscovererTest.php
+++ b/tests/phpunit/unit/includes/libs/DnsSrvDiscovererTest.php
@@ -100,7 +100,7 @@ class DnsSrvDiscovererTest extends PHPUnit\Framework\TestCase {
[ 'target' => '.', 'port' => '1', 'pri' => '1', 'weight' => '1' ],
] );
- $this->assertEmpty( $dsd->getServers() );
+ $this->assertSame( [], $dsd->getServers() );
}
private function mockResolver() {
diff --git a/tests/phpunit/unit/maintenance/MaintenanceParametersTest.php b/tests/phpunit/unit/maintenance/MaintenanceParametersTest.php
index e3160a53db7..df3b27ab696 100644
--- a/tests/phpunit/unit/maintenance/MaintenanceParametersTest.php
+++ b/tests/phpunit/unit/maintenance/MaintenanceParametersTest.php
@@ -214,7 +214,7 @@ class MaintenanceParametersTest extends TestCase {
$params->validate();
$this->assertFalse( $params->hasErrors() );
- $this->assertEmpty( $params->getErrors() );
+ $this->assertSame( [], $params->getErrors() );
$this->assertSame( $expectedOptions, $params->getOptions() );
$this->assertSame( $expectedArgs, $params->getArgs() );