aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit
diff options
context:
space:
mode:
authorReedy <reedy@wikimedia.org>2021-11-21 19:13:24 +0000
committerReedy <reedy@wikimedia.org>2021-11-21 19:35:49 +0000
commit8c39aab84b3e476a5d68c299da3e0e0e2066957e (patch)
tree9d6fdfdea1069ba55a7bb53c5e515065a135e958 /tests/phpunit
parent6e296116426e42aa57f8fa907158aa2552438cac (diff)
downloadmediawikicore-8c39aab84b3e476a5d68c299da3e0e0e2066957e.tar.gz
mediawikicore-8c39aab84b3e476a5d68c299da3e0e0e2066957e.zip
Remove or replace usages of "sanity"
Bug: T254646 Change-Id: Ib192dc5704a14d02c7c374d0ab29bac55c5df24a
Diffstat (limited to 'tests/phpunit')
-rw-r--r--tests/phpunit/includes/EditPageConstraintsTest.php4
-rw-r--r--tests/phpunit/includes/EditPageTest.php1
-rw-r--r--tests/phpunit/includes/MessageTest.php4
-rw-r--r--tests/phpunit/includes/MovePageTest.php2
-rw-r--r--tests/phpunit/includes/ParamValidator/TypeDef/TitleDefTest.php2
-rw-r--r--tests/phpunit/includes/Permissions/PermissionManagerTest.php14
-rw-r--r--tests/phpunit/includes/Revision/RevisionStoreDbTest.php2
-rw-r--r--tests/phpunit/includes/api/ApiBlockTest.php4
-rw-r--r--tests/phpunit/includes/api/ApiChangeContentModelTest.php12
-rw-r--r--tests/phpunit/includes/api/ApiClearHasMsgTest.php2
-rw-r--r--tests/phpunit/includes/api/ApiEditPageTest.php2
-rw-r--r--tests/phpunit/includes/api/ApiLoginTest.php5
-rw-r--r--tests/phpunit/includes/api/ApiLogoutTest.php4
-rw-r--r--tests/phpunit/includes/api/ApiMainTest.php2
-rw-r--r--tests/phpunit/includes/api/ApiMoveTest.php2
-rw-r--r--tests/phpunit/includes/api/ApiStashEditTest.php2
-rw-r--r--tests/phpunit/includes/api/Validator/SubmoduleDefTest.php8
-rw-r--r--tests/phpunit/includes/api/format/ApiFormatBaseTest.php9
-rw-r--r--tests/phpunit/includes/api/query/ApiQuerySiteinfoTest.php4
-rw-r--r--tests/phpunit/includes/auth/AuthManagerTest.php26
-rw-r--r--tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php7
-rw-r--r--tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php7
-rw-r--r--tests/phpunit/includes/content/ContentModelChangeTest.php10
-rw-r--r--tests/phpunit/includes/session/CookieSessionProviderTest.php2
-rw-r--r--tests/phpunit/includes/session/ImmutableSessionProviderWithCookieTest.php2
-rw-r--r--tests/phpunit/includes/session/PHPSessionHandlerTest.php4
-rw-r--r--tests/phpunit/includes/session/SessionBackendTest.php48
-rw-r--r--tests/phpunit/includes/session/SessionManagerTest.php26
-rw-r--r--tests/phpunit/includes/session/UserInfoTest.php4
-rw-r--r--tests/phpunit/includes/site/CachingSiteStoreTest.php2
-rw-r--r--tests/phpunit/includes/user/BotPasswordTest.php18
-rw-r--r--tests/phpunit/includes/user/ExternalUserNamesTest.php2
-rw-r--r--tests/phpunit/includes/user/UserEditTrackerTest.php2
-rw-r--r--tests/phpunit/includes/user/UserTest.php18
34 files changed, 126 insertions, 137 deletions
diff --git a/tests/phpunit/includes/EditPageConstraintsTest.php b/tests/phpunit/includes/EditPageConstraintsTest.php
index 3e85f36f6c54..829bfd2dc9d9 100644
--- a/tests/phpunit/includes/EditPageConstraintsTest.php
+++ b/tests/phpunit/includes/EditPageConstraintsTest.php
@@ -99,7 +99,7 @@ class EditPageConstraintsTest extends MediaWikiLangTestCase {
$this->assertEquals(
rtrim( $baseText ),
rtrim( $currentText ),
- 'Sanity check: page should have the text specified'
+ 'page should have the text specified'
);
}
@@ -265,7 +265,7 @@ class EditPageConstraintsTest extends MediaWikiLangTestCase {
$this->assertSame(
CONTENT_MODEL_WIKITEXT,
$title->getContentModel(),
- 'Sanity check: title should start as wikitext content model'
+ 'title should start as wikitext content model'
);
$this->assertEdit(
diff --git a/tests/phpunit/includes/EditPageTest.php b/tests/phpunit/includes/EditPageTest.php
index ab84d26db3c1..0762028f8912 100644
--- a/tests/phpunit/includes/EditPageTest.php
+++ b/tests/phpunit/includes/EditPageTest.php
@@ -148,7 +148,6 @@ class EditPageTest extends MediaWikiLangTestCase {
$page->doUserEditContent( $content, $user, "base text for test" );
$this->forceRevisionDate( $page, '20120101000000' );
- // sanity check
$page->clear();
$content = $page->getContent();
diff --git a/tests/phpunit/includes/MessageTest.php b/tests/phpunit/includes/MessageTest.php
index 9f758b0d764b..620aaa0193c7 100644
--- a/tests/phpunit/includes/MessageTest.php
+++ b/tests/phpunit/includes/MessageTest.php
@@ -891,7 +891,7 @@ class MessageTest extends MediaWikiLangTestCase {
$msg = new Message( 'parentheses' );
$msg->rawParams( '<a>foo</a>' );
$msg->page( PageReferenceValue::localReference( NS_MAIN, 'Testing' ) );
- $this->assertSame( '(<a>foo</a>)', $msg->parse(), 'Sanity check' );
+ $this->assertSame( '(<a>foo</a>)', $msg->parse() );
$msg = unserialize( serialize( $msg ) );
$this->assertSame( '(<a>foo</a>)', $msg->parse() );
$title = TestingAccessWrapper::newFromObject( $msg )->contextPage;
@@ -900,7 +900,7 @@ class MessageTest extends MediaWikiLangTestCase {
$msg = new Message( 'mainpage' );
$msg->inLanguage( 'de' );
- $this->assertSame( 'Hauptseite', $msg->plain(), 'Sanity check' );
+ $this->assertSame( 'Hauptseite', $msg->plain() );
$msg = unserialize( serialize( $msg ) );
$this->assertSame( 'Hauptseite', $msg->plain() );
}
diff --git a/tests/phpunit/includes/MovePageTest.php b/tests/phpunit/includes/MovePageTest.php
index f7ea22274c3a..57df3a395637 100644
--- a/tests/phpunit/includes/MovePageTest.php
+++ b/tests/phpunit/includes/MovePageTest.php
@@ -479,7 +479,7 @@ class MovePageTest extends MediaWikiIntegrationTestCase {
$this->assertSame(
[],
$mp->isValidMove()->getErrorsArray(),
- 'Sanity check - can move over normal redirect'
+ 'Can move over normal redirect'
);
$this->editPage( 'ExistentRedirect3', '#REDIRECT [[Existent]]' );
diff --git a/tests/phpunit/includes/ParamValidator/TypeDef/TitleDefTest.php b/tests/phpunit/includes/ParamValidator/TypeDef/TitleDefTest.php
index efcf572cf9f6..f1f75b143462 100644
--- a/tests/phpunit/includes/ParamValidator/TypeDef/TitleDefTest.php
+++ b/tests/phpunit/includes/ParamValidator/TypeDef/TitleDefTest.php
@@ -38,7 +38,7 @@ class TitleDefTest extends TypeDefTestCase {
->newPageUpdater( new User )
->setContent( SlotRecord::MAIN, new WikitextContent( 'exists' ) );
$updater->saveRevision( CommentStoreComment::newUnsavedComment( 'test' ) );
- $this->assertTrue( $updater->getStatus()->isOK(), 'sanity' );
+ $this->assertTrue( $updater->getStatus()->isOK() );
}
parent::testValidate( $value, $expect, $settings, $options, $expectConds );
}
diff --git a/tests/phpunit/includes/Permissions/PermissionManagerTest.php b/tests/phpunit/includes/Permissions/PermissionManagerTest.php
index cc84c86559f3..0e0d591dafa4 100644
--- a/tests/phpunit/includes/Permissions/PermissionManagerTest.php
+++ b/tests/phpunit/includes/Permissions/PermissionManagerTest.php
@@ -757,9 +757,9 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
// First, check the user isn't blocked
$user = $this->getMutableTestUser()->getUser();
$ut = Title::makeTitle( NS_USER_TALK, $user->getName() );
- $this->assertNull( $user->getBlock( false ), 'sanity check' );
+ $this->assertNull( $user->getBlock( false ) );
$this->assertFalse( MediaWikiServices::getInstance()->getPermissionManager()
- ->isBlockedFrom( $user, $ut ), 'sanity check' );
+ ->isBlockedFrom( $user, $ut ) );
// Block the user
$blocker = $this->getTestSysop()->getUser();
@@ -772,7 +772,7 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
$block->setBlocker( $blocker );
$blockStore = MediaWikiServices::getInstance()->getDatabaseBlockStore();
$res = $blockStore->insertBlock( $block );
- $this->assertTrue( (bool)$res['id'], 'sanity check: Failed to insert block' );
+ $this->assertTrue( (bool)$res['id'], 'Failed to insert block' );
// Clear cache and confirm it loaded the block properly
$user->clearInstanceCache();
@@ -944,10 +944,10 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
$permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
$rights = $permissionManager->getUserPermissions( $user );
- $this->assertContains( 'test', $rights, 'sanity check' );
- $this->assertContains( 'runtest', $rights, 'sanity check' );
- $this->assertContains( 'writetest', $rights, 'sanity check' );
- $this->assertNotContains( 'nukeworld', $rights, 'sanity check' );
+ $this->assertContains( 'test', $rights );
+ $this->assertContains( 'runtest', $rights );
+ $this->assertContains( 'writetest', $rights );
+ $this->assertNotContains( 'nukeworld', $rights );
// Add a hook manipluating the rights
$this->setTemporaryHook( 'UserGetRights', static function ( $user, &$rights ) {
diff --git a/tests/phpunit/includes/Revision/RevisionStoreDbTest.php b/tests/phpunit/includes/Revision/RevisionStoreDbTest.php
index 4c2f8d304010..d0d3489948a1 100644
--- a/tests/phpunit/includes/Revision/RevisionStoreDbTest.php
+++ b/tests/phpunit/includes/Revision/RevisionStoreDbTest.php
@@ -2993,7 +2993,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase {
$actorNormalization = $this->getServiceContainer()->getActorNormalization();
$actorId = $actorNormalization->findActorId( $user, $this->db );
- $this->assertNull( $actorId, 'Sanity, new actor has no actor_id' );
+ $this->assertNull( $actorId, 'New actor has no actor_id' );
$page = $this->getTestPage();
$rev = new MutableRevisionRecord( $page->getTitle() );
diff --git a/tests/phpunit/includes/api/ApiBlockTest.php b/tests/phpunit/includes/api/ApiBlockTest.php
index 7e769bf69330..5f5fb3c3fdc4 100644
--- a/tests/phpunit/includes/api/ApiBlockTest.php
+++ b/tests/phpunit/includes/api/ApiBlockTest.php
@@ -39,7 +39,7 @@ class ApiBlockTest extends ApiTestCase {
* @return array result of doApiRequest
*/
private function doBlock( array $extraParams = [], User $blocker = null ) {
- $this->assertNotNull( $this->mUser, 'Sanity check' );
+ $this->assertNotNull( $this->mUser );
$params = [
'action' => 'block',
@@ -112,7 +112,7 @@ class ApiBlockTest extends ApiTestCase {
$this->expectException( ApiUsageException::class );
$this->expectExceptionMessage( "There is no user with ID $id." );
- $this->assertFalse( User::whoIs( $id ), 'Sanity check' );
+ $this->assertFalse( User::whoIs( $id ) );
$this->doBlock( [ 'userid' => $id ] );
}
diff --git a/tests/phpunit/includes/api/ApiChangeContentModelTest.php b/tests/phpunit/includes/api/ApiChangeContentModelTest.php
index 0816cae44668..1c030dc26b0d 100644
--- a/tests/phpunit/includes/api/ApiChangeContentModelTest.php
+++ b/tests/phpunit/includes/api/ApiChangeContentModelTest.php
@@ -44,7 +44,7 @@ class ApiChangeContentModelTest extends ApiTestCase {
$this->assertFalse(
Title::newFromText( $name )->exists(),
- 'Sanity check that title does not exist already'
+ 'Check that title does not exist already'
);
$this->setExpectedApiException( 'apierror-changecontentmodel-missingtitle' );
@@ -81,7 +81,7 @@ class ApiChangeContentModelTest extends ApiTestCase {
$this->assertSame(
'wikitext',
Title::newFromText( 'ExistingPage' )->getContentModel(),
- 'Sanity check: `ExistingPage` should be wikitext'
+ '`ExistingPage` should be wikitext'
);
$this->setExpectedApiException( 'apierror-nochanges' );
@@ -108,7 +108,7 @@ class ApiChangeContentModelTest extends ApiTestCase {
$this->assertSame(
'wikitext',
$wikipage->getTitle()->getContentModel(),
- 'Sanity check: `PageWithTextThatIsNotValidJSON` should be wikitext at first'
+ '`PageWithTextThatIsNotValidJSON` should be wikitext at first'
);
$this->setExpectedApiException( 'invalid-content-data' );
@@ -135,7 +135,7 @@ class ApiChangeContentModelTest extends ApiTestCase {
$this->assertSame(
'wikitext',
$title->getContentModel( Title::READ_LATEST ),
- 'Sanity check: `ExistingPage` should be wikitext'
+ '`ExistingPage` should be wikitext'
);
$this->setTemporaryHook( 'EditFilterMergedContent',
@@ -180,7 +180,7 @@ class ApiChangeContentModelTest extends ApiTestCase {
$this->assertSame(
'wikitext',
$title->getContentModel( Title::READ_LATEST ),
- 'Sanity check: `ExistingPage` should be wikitext'
+ '`ExistingPage` should be wikitext'
);
$this->setTemporaryHook( 'ContentModelCanBeUsedOn',
@@ -265,7 +265,7 @@ class ApiChangeContentModelTest extends ApiTestCase {
$this->assertSame(
'wikitext',
$title->getContentModel( Title::READ_LATEST ),
- 'Sanity check: `ExistingPage` should be wikitext'
+ '`ExistingPage` should be wikitext'
);
ChangeTags::defineTag( 'api edit content model tag' );
diff --git a/tests/phpunit/includes/api/ApiClearHasMsgTest.php b/tests/phpunit/includes/api/ApiClearHasMsgTest.php
index f63fa0afdac9..0a45a397fb74 100644
--- a/tests/phpunit/includes/api/ApiClearHasMsgTest.php
+++ b/tests/phpunit/includes/api/ApiClearHasMsgTest.php
@@ -17,7 +17,7 @@ class ApiClearHasMsgTest extends ApiTestCase {
$talkPageNotificationManager = MediaWikiServices::getInstance()
->getTalkPageNotificationManager();
$talkPageNotificationManager->setUserHasNewMessages( $user );
- $this->assertTrue( $talkPageNotificationManager->userHasNewMessages( $user ), 'sanity check' );
+ $this->assertTrue( $talkPageNotificationManager->userHasNewMessages( $user ) );
$data = $this->doApiRequest( [ 'action' => 'clearhasmsg' ], [] );
diff --git a/tests/phpunit/includes/api/ApiEditPageTest.php b/tests/phpunit/includes/api/ApiEditPageTest.php
index d1d779048a47..8167a968b3d7 100644
--- a/tests/phpunit/includes/api/ApiEditPageTest.php
+++ b/tests/phpunit/includes/api/ApiEditPageTest.php
@@ -1560,7 +1560,7 @@ class ApiEditPageTest extends ApiTestCase {
public function testEditWhileBlocked() {
$name = 'Help:' . ucfirst( __FUNCTION__ );
- $this->assertNull( DatabaseBlock::newFromTarget( '127.0.0.1' ), 'Sanity check' );
+ $this->assertNull( DatabaseBlock::newFromTarget( '127.0.0.1' ) );
$block = new DatabaseBlock( [
'address' => self::$users['sysop']->getUser()->getName(),
diff --git a/tests/phpunit/includes/api/ApiLoginTest.php b/tests/phpunit/includes/api/ApiLoginTest.php
index f89b974f8f78..4477cba8a503 100644
--- a/tests/phpunit/includes/api/ApiLoginTest.php
+++ b/tests/phpunit/includes/api/ApiLoginTest.php
@@ -286,15 +286,14 @@ class ApiLoginTest extends ApiTestCase {
$manager->sessionProviders = $tmp + $manager->getProviders();
}
$this->assertNotNull(
- SessionManager::singleton()->getProvider( BotPasswordSessionProvider::class ),
- 'sanity check'
+ SessionManager::singleton()->getProvider( BotPasswordSessionProvider::class )
);
$user = self::$users['sysop'];
$centralId = $this->getServiceContainer()
->getCentralIdLookup()
->centralIdFromLocalUser( $user->getUser() );
- $this->assertNotSame( 0, $centralId, 'sanity check' );
+ $this->assertNotSame( 0, $centralId );
$password = 'ngfhmjm64hv0854493hsj5nncjud2clk';
$passwordFactory = MediaWikiServices::getInstance()->getPasswordFactory();
diff --git a/tests/phpunit/includes/api/ApiLogoutTest.php b/tests/phpunit/includes/api/ApiLogoutTest.php
index 114d201a69d8..8d85a68639a5 100644
--- a/tests/phpunit/includes/api/ApiLogoutTest.php
+++ b/tests/phpunit/includes/api/ApiLogoutTest.php
@@ -34,7 +34,7 @@ class ApiLogoutTest extends ApiTestCase {
public function testUserLogout() {
$user = $this->getTestSysop()->getUser();
- $this->assertTrue( $user->isRegistered(), 'sanity check' );
+ $this->assertTrue( $user->isRegistered() );
$token = $this->getUserCsrfTokenFromApi( $user );
$this->doUserLogout( $token, $user );
$this->assertFalse( $user->isRegistered() );
@@ -44,7 +44,7 @@ class ApiLogoutTest extends ApiTestCase {
global $wgRequest;
$user = $this->getTestSysop()->getUser();
- $this->assertTrue( $user->isRegistered(), 'sanity check' );
+ $this->assertTrue( $user->isRegistered() );
// Logic copied from SkinTemplate.
$token = $user->getEditToken( 'logoutToken', $wgRequest );
diff --git a/tests/phpunit/includes/api/ApiMainTest.php b/tests/phpunit/includes/api/ApiMainTest.php
index daefc0cf753f..0fdb3c5900b1 100644
--- a/tests/phpunit/includes/api/ApiMainTest.php
+++ b/tests/phpunit/includes/api/ApiMainTest.php
@@ -455,7 +455,7 @@ class ApiMainTest extends ApiTestCase {
], null, null, new User );
$this->fail( 'Expected exception not thrown' );
} catch ( ApiUsageException $e ) {
- $this->assertTrue( self::apiExceptionHasCode( $e, 'toomanyvalues' ), 'sanity check' );
+ $this->assertTrue( self::apiExceptionHasCode( $e, 'toomanyvalues' ) );
}
// Now test that the assert happens first
diff --git a/tests/phpunit/includes/api/ApiMoveTest.php b/tests/phpunit/includes/api/ApiMoveTest.php
index 9c4cbbcfbc42..d26bb47a030a 100644
--- a/tests/phpunit/includes/api/ApiMoveTest.php
+++ b/tests/phpunit/includes/api/ApiMoveTest.php
@@ -205,7 +205,7 @@ class ApiMoveTest extends ApiTestCase {
}
public function testMoveWhileBlocked() {
- $this->assertNull( DatabaseBlock::newFromTarget( '127.0.0.1' ), 'Sanity check' );
+ $this->assertNull( DatabaseBlock::newFromTarget( '127.0.0.1' ) );
$blockStore = MediaWikiServices::getInstance()->getDatabaseBlockStore();
$block = new DatabaseBlock( [
diff --git a/tests/phpunit/includes/api/ApiStashEditTest.php b/tests/phpunit/includes/api/ApiStashEditTest.php
index b1c8da55437a..45340bd57458 100644
--- a/tests/phpunit/includes/api/ApiStashEditTest.php
+++ b/tests/phpunit/includes/api/ApiStashEditTest.php
@@ -90,7 +90,7 @@ class ApiStashEditTest extends ApiTestCase {
$this->assertSame( $expectedHash, $hash );
if ( isset( $params['stashedtexthash'] ) ) {
- $this->assertSame( $params['stashedtexthash'], $expectedHash, 'Sanity' );
+ $this->assertSame( $params['stashedtexthash'], $expectedHash );
}
} else {
$this->assertSame( $origText, $this->getStashedText( $expectedHash ) );
diff --git a/tests/phpunit/includes/api/Validator/SubmoduleDefTest.php b/tests/phpunit/includes/api/Validator/SubmoduleDefTest.php
index 4f44f6d1374a..da111529f224 100644
--- a/tests/phpunit/includes/api/Validator/SubmoduleDefTest.php
+++ b/tests/phpunit/includes/api/Validator/SubmoduleDefTest.php
@@ -82,10 +82,10 @@ class SubmoduleDefTest extends TypeDefTestCase {
] );
$manager->addModule( 'mod3', 'xyz', MockApi::class );
- $this->assertSame( $api, $api->getModuleFromPath( 'testmod' ), 'sanity check' );
- $this->assertSame( $dep, $api->getModuleFromPath( 'testmod+dep' ), 'sanity check' );
- $this->assertSame( $int, $api->getModuleFromPath( 'testmod+int' ), 'sanity check' );
- $this->assertSame( $depint, $api->getModuleFromPath( 'testmod+depint' ), 'sanity check' );
+ $this->assertSame( $api, $api->getModuleFromPath( 'testmod' ) );
+ $this->assertSame( $dep, $api->getModuleFromPath( 'testmod+dep' ) );
+ $this->assertSame( $int, $api->getModuleFromPath( 'testmod+int' ) );
+ $this->assertSame( $depint, $api->getModuleFromPath( 'testmod+depint' ) );
return $api;
}
diff --git a/tests/phpunit/includes/api/format/ApiFormatBaseTest.php b/tests/phpunit/includes/api/format/ApiFormatBaseTest.php
index 1e7763567eaa..ccfc8841526b 100644
--- a/tests/phpunit/includes/api/format/ApiFormatBaseTest.php
+++ b/tests/phpunit/includes/api/format/ApiFormatBaseTest.php
@@ -246,7 +246,7 @@ class ApiFormatBaseTest extends ApiFormatTestBase {
$printer->printText( 'Foo' );
} );
$printer->method( 'getMimeType' )->willReturn( null );
- $this->assertNull( $printer->getMimeType(), 'sanity check' );
+ $this->assertNull( $printer->getMimeType() );
$printer->initPrinter();
$printer->execute();
@@ -263,8 +263,8 @@ class ApiFormatBaseTest extends ApiFormatTestBase {
$printer->printText( 'Foo' );
} );
$printer->method( 'getMimeType' )->willReturn( null );
- $this->assertNull( $printer->getMimeType(), 'sanity check' );
- $this->assertTrue( $printer->getIsHtml(), 'sanity check' );
+ $this->assertNull( $printer->getMimeType() );
+ $this->assertTrue( $printer->getIsHtml() );
$printer->initPrinter();
$printer->execute();
@@ -320,8 +320,7 @@ class ApiFormatBaseTest extends ApiFormatTestBase {
$printer->method( 'getAllowedParams' )->willReturn( $allowedParams );
$this->assertEquals(
[ 'foo' => '1', 'bar' => '2', 'baz' => '3' ],
- $printer->extractRequestParams(),
- 'sanity check'
+ $printer->extractRequestParams()
);
$printer = $this->getMockFormatter( $main, 'mock', [ 'getAllowedParams' ] );
diff --git a/tests/phpunit/includes/api/query/ApiQuerySiteinfoTest.php b/tests/phpunit/includes/api/query/ApiQuerySiteinfoTest.php
index 869172b64aa3..83cc407168ae 100644
--- a/tests/phpunit/includes/api/query/ApiQuerySiteinfoTest.php
+++ b/tests/phpunit/includes/api/query/ApiQuerySiteinfoTest.php
@@ -55,7 +55,7 @@ class ApiQuerySiteinfoTest extends ApiTestCase {
public function testLinkPrefixCharset() {
$contLang = MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'ar' );
$this->setContentLang( $contLang );
- $this->assertTrue( $contLang->linkPrefixExtension(), 'Sanity check' );
+ $this->assertTrue( $contLang->linkPrefixExtension() );
$data = $this->doQuery();
@@ -65,7 +65,7 @@ class ApiQuerySiteinfoTest extends ApiTestCase {
public function testVariants() {
$contLang = MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'zh' );
$this->setContentLang( $contLang );
- $this->assertTrue( $contLang->hasVariants(), 'Sanity check' );
+ $this->assertTrue( $contLang->hasVariants() );
$data = $this->doQuery();
diff --git a/tests/phpunit/includes/auth/AuthManagerTest.php b/tests/phpunit/includes/auth/AuthManagerTest.php
index 1422165e7aa1..09385764c3b6 100644
--- a/tests/phpunit/includes/auth/AuthManagerTest.php
+++ b/tests/phpunit/includes/auth/AuthManagerTest.php
@@ -413,7 +413,7 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase {
$this->config->set( 'AllowSecuritySensitiveOperationIfCannotReauthenticate', [] );
$provideUser = new \User;
$session = $provider->getManager()->getSessionForRequest( $this->request );
- $this->assertSame( 0, $session->getUser()->getId(), 'sanity check' );
+ $this->assertSame( 0, $session->getUser()->getId() );
// Anonymous user => reauth
$session->set( 'AuthManager:lastAuthId', 0 );
@@ -422,7 +422,7 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase {
$provideUser = $user;
$session = $provider->getManager()->getSessionForRequest( $this->request );
- $this->assertSame( $user->getId(), $session->getUser()->getId(), 'sanity check' );
+ $this->assertSame( $user->getId(), $session->getUser()->getId() );
// Error for no default (only gets thrown for non-anonymous user)
$session->set( 'AuthManager:lastAuthId', $user->getId() + 1 );
@@ -711,8 +711,7 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase {
$this->initializeManager( false );
$this->assertSame(
[ 'A' => $mock1, 'B' => $mock2, 'C' => $mock3 ],
- $this->managerPriv->getPrimaryAuthenticationProviders(),
- 'sanity check'
+ $this->managerPriv->getPrimaryAuthenticationProviders()
);
$config['primaryauth']['A']['sort'] = 100;
@@ -946,7 +945,7 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase {
->willReturn( $res );
$this->logger->setCollect( true );
$ret = $this->manager->beginAuthentication( [], 'http://localhost/' );
- $this->assertSame( AuthenticationResponse::UI, $ret->status, 'sanity check' );
+ $this->assertSame( AuthenticationResponse::UI, $ret->status );
$ret = $this->manager->continueAuthentication( [] );
$this->logger->setCollect( false );
$this->assertSame( AuthenticationResponse::FAIL, $ret->status );
@@ -2510,8 +2509,8 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase {
$this->assertSame( AuthenticationResponse::PASS, $ret->status );
$user = \User::newFromName( $username );
- $this->assertNotEquals( 0, $user->getId(), 'sanity check' );
- $this->assertNotEquals( $creator->getId(), $user->getId(), 'sanity check' );
+ $this->assertNotEquals( 0, $user->getId() );
+ $this->assertNotEquals( $creator->getId(), $user->getId() );
$data = \DatabaseLogEntry::getSelectQueryData();
$rows = iterator_to_array( $dbw->select(
@@ -2919,7 +2918,7 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase {
// Test addToDatabase throws an exception
$cache = \ObjectCache::getLocalClusterInstance();
$backoffKey = $cache->makeKey( 'AuthManager', 'autocreate-failed', md5( $username ) );
- $this->assertFalse( $cache->get( $backoffKey ), 'sanity check' );
+ $this->assertFalse( $cache->get( $backoffKey ) );
$session->clear();
$user = $this->getMockBuilder( \User::class )
->onlyMethods( [ 'addToDatabase' ] )->getMock();
@@ -2951,7 +2950,7 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase {
->will( $this->returnCallback( function () use ( $username, &$user ) {
$oldUser = \User::newFromName( $username );
$status = $oldUser->addToDatabase();
- $this->assertTrue( $status->isOK(), 'sanity check' );
+ $this->assertTrue( $status->isOK() );
$user->setId( $oldUser->getId() );
return Status::newFatal( 'userexists' );
} ) );
@@ -3408,8 +3407,7 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase {
$session = $this->request->getSession();
$session->clear();
- $this->assertSame( 0, \User::newFromName( $username )->getId(),
- 'sanity check' );
+ $this->assertSame( 0, \User::newFromName( $username )->getId() );
$callback = $this->callback( static function ( $user ) use ( $username ) {
return $user->getName() === $username;
@@ -3457,10 +3455,8 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase {
$session = $this->request->getSession();
$session->clear();
- $this->assertSame( 0, $session->getUser()->getId(),
- 'sanity check' );
- $this->assertSame( 0, \User::newFromName( $username )->getId(),
- 'sanity check' );
+ $this->assertSame( 0, $session->getUser()->getId() );
+ $this->assertSame( 0, \User::newFromName( $username )->getId() );
$this->hook( 'UserLoggedIn', UserLoggedInHook::class, $this->never() );
$this->hook( 'LocalUserCreated', LocalUserCreatedHook::class, $this->never() );
diff --git a/tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php b/tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php
index 1ab0c72b6e3a..7044f26a214d 100644
--- a/tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php
+++ b/tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php
@@ -482,8 +482,7 @@ class LocalPasswordPrimaryAuthenticationProviderTest extends \MediaWikiIntegrati
$loginReqs = [ PasswordAuthenticationRequest::class => $loginReq ];
$this->assertEquals(
AuthenticationResponse::newPass( $cuser ),
- $provider->beginPrimaryAuthentication( $loginReqs ),
- 'Sanity check'
+ $provider->beginPrimaryAuthentication( $loginReqs )
);
if ( $type === PasswordAuthenticationRequest::class ) {
@@ -686,10 +685,10 @@ class LocalPasswordPrimaryAuthenticationProviderTest extends \MediaWikiIntegrati
$expect->createRequest = $req;
$res2 = $provider->beginPrimaryAccountCreation( $user, $user, $reqs );
- $this->assertEquals( $expect, $res2, 'Sanity check' );
+ $this->assertEquals( $expect, $res2 );
$ret = $provider->beginPrimaryAuthentication( $reqs );
- $this->assertEquals( AuthenticationResponse::FAIL, $ret->status, 'sanity check' );
+ $this->assertEquals( AuthenticationResponse::FAIL, $ret->status );
$this->assertNull( $provider->finishAccountCreation( $user, $user, $res2 ) );
$ret = $provider->beginPrimaryAuthentication( $reqs );
diff --git a/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php b/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php
index 9f02ce905bba..443db40078a1 100644
--- a/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php
+++ b/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php
@@ -464,8 +464,7 @@ class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiInteg
$loginReqs = [ PasswordAuthenticationRequest::class => $loginReq ];
$this->assertEquals(
AuthenticationResponse::newPass( $cuser ),
- $provider->beginPrimaryAuthentication( $loginReqs ),
- 'Sanity check'
+ $provider->beginPrimaryAuthentication( $loginReqs )
);
if ( $type === PasswordAuthenticationRequest::class ||
@@ -692,10 +691,10 @@ class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiInteg
$expect->createRequest = $req;
$res2 = $provider->beginPrimaryAccountCreation( $user, $user, $reqs );
- $this->assertEquals( $expect, $res2, 'Sanity check' );
+ $this->assertEquals( $expect, $res2 );
$ret = $provider->beginPrimaryAuthentication( $authreqs );
- $this->assertEquals( AuthenticationResponse::FAIL, $ret->status, 'sanity check' );
+ $this->assertEquals( AuthenticationResponse::FAIL, $ret->status );
$this->assertSame( null, $provider->finishAccountCreation( $user, $user, $res2 ) );
diff --git a/tests/phpunit/includes/content/ContentModelChangeTest.php b/tests/phpunit/includes/content/ContentModelChangeTest.php
index 1cc317ce8f69..5cc13597a364 100644
--- a/tests/phpunit/includes/content/ContentModelChangeTest.php
+++ b/tests/phpunit/includes/content/ContentModelChangeTest.php
@@ -52,7 +52,7 @@ class ContentModelChangeTest extends MediaWikiIntegrationTestCase {
$this->assertSame(
'wikitext',
$wikipage->getTitle()->getContentModel(),
- 'Sanity check: `ExistingPage` should be wikitext'
+ '`ExistingPage` should be wikitext'
);
$change = $this->newContentModelChange(
@@ -88,7 +88,7 @@ class ContentModelChangeTest extends MediaWikiIntegrationTestCase {
$this->assertSame(
'wikitext',
$wikipage->getTitle()->getContentModel(),
- 'Sanity check: `PageWithTextThatIsNotValidJSON` should be wikitext at first'
+ '`PageWithTextThatIsNotValidJSON` should be wikitext at first'
);
$change = $this->newContentModelChange(
@@ -121,7 +121,7 @@ class ContentModelChangeTest extends MediaWikiIntegrationTestCase {
$this->assertSame(
'wikitext',
$wikipage->getTitle()->getContentModel( Title::READ_LATEST ),
- 'Sanity check: `ExistingPage` should be wikitext'
+ '`ExistingPage` should be wikitext'
);
$this->setTemporaryHook( 'EditFilterMergedContent',
@@ -172,7 +172,7 @@ class ContentModelChangeTest extends MediaWikiIntegrationTestCase {
$this->assertSame(
'wikitext',
$wikipage->getTitle()->getContentModel( Title::READ_LATEST ),
- 'Sanity check: `ExistingPage` should be wikitext'
+ '`ExistingPage` should be wikitext'
);
$this->setTemporaryHook( 'ContentModelCanBeUsedOn',
@@ -274,7 +274,7 @@ class ContentModelChangeTest extends MediaWikiIntegrationTestCase {
$this->assertSame(
'wikitext',
$currentContentModel,
- 'Sanity check: `ExistingPage` should be wikitext'
+ '`ExistingPage` should be wikitext'
);
$performer = $this->mockRegisteredAuthority( static function (
diff --git a/tests/phpunit/includes/session/CookieSessionProviderTest.php b/tests/phpunit/includes/session/CookieSessionProviderTest.php
index 0041e17a0adb..f3b860c1638b 100644
--- a/tests/phpunit/includes/session/CookieSessionProviderTest.php
+++ b/tests/phpunit/includes/session/CookieSessionProviderTest.php
@@ -538,7 +538,7 @@ class CookieSessionProviderTest extends MediaWikiIntegrationTestCase {
$sessionId = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
$user = static::getTestSysop()->getUser();
- $this->assertSame( $user->requiresHTTPS(), $forceHTTPS, 'sanity check' );
+ $this->assertSame( $user->requiresHTTPS(), $forceHTTPS );
$backend = new SessionBackend(
new SessionId( $sessionId ),
diff --git a/tests/phpunit/includes/session/ImmutableSessionProviderWithCookieTest.php b/tests/phpunit/includes/session/ImmutableSessionProviderWithCookieTest.php
index 38c1f86c402b..9bd4e212daef 100644
--- a/tests/phpunit/includes/session/ImmutableSessionProviderWithCookieTest.php
+++ b/tests/phpunit/includes/session/ImmutableSessionProviderWithCookieTest.php
@@ -200,7 +200,7 @@ class ImmutableSessionProviderWithCookieTest extends MediaWikiIntegrationTestCas
$sessionId = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
$user = User::newFromName( 'UTSysop' );
- $this->assertSame( $forceHTTPS, $user->requiresHTTPS(), 'sanity check' );
+ $this->assertSame( $forceHTTPS, $user->requiresHTTPS() );
$backend = new SessionBackend(
new SessionId( $sessionId ),
diff --git a/tests/phpunit/includes/session/PHPSessionHandlerTest.php b/tests/phpunit/includes/session/PHPSessionHandlerTest.php
index 9c737b2cdbe1..7ea370ffd554 100644
--- a/tests/phpunit/includes/session/PHPSessionHandlerTest.php
+++ b/tests/phpunit/includes/session/PHPSessionHandlerTest.php
@@ -296,13 +296,13 @@ class PHPSessionHandlerTest extends MediaWikiIntegrationTestCase {
return false;
} ],
] );
- $this->assertNull( $manager->getSessionById( $id, true ), 'sanity check' );
+ $this->assertNull( $manager->getSessionById( $id, true ) );
session_write_close();
$this->mergeMwGlobalArrayValue( 'wgHooks', [
'SessionCheckInfo' => [],
] );
- $this->assertNotNull( $manager->getSessionById( $id, true ), 'sanity check' );
+ $this->assertNotNull( $manager->getSessionById( $id, true ) );
}
public static function provideHandlers() {
diff --git a/tests/phpunit/includes/session/SessionBackendTest.php b/tests/phpunit/includes/session/SessionBackendTest.php
index cead1023b90e..e1a17cedae9e 100644
--- a/tests/phpunit/includes/session/SessionBackendTest.php
+++ b/tests/phpunit/includes/session/SessionBackendTest.php
@@ -261,17 +261,17 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$this->assertSame( '$metadata must be an array or null', $ex->getMessage() );
}
- $this->assertFalse( $this->store->getSession( self::SESSIONID ), 'sanity check' );
+ $this->assertFalse( $this->store->getSession( self::SESSIONID ) );
$backend->setProviderMetadata( [ 'dummy' ] );
$this->assertFalse( $this->store->getSession( self::SESSIONID ) );
- $this->assertFalse( $this->store->getSession( self::SESSIONID ), 'sanity check' );
+ $this->assertFalse( $this->store->getSession( self::SESSIONID ) );
$backend->setProviderMetadata( [ 'test' ] );
$this->assertNotFalse( $this->store->getSession( self::SESSIONID ) );
$this->assertSame( [ 'test' ], $backend->getProviderMetadata() );
$this->store->deleteSession( self::SESSIONID );
- $this->assertFalse( $this->store->getSession( self::SESSIONID ), 'sanity check' );
+ $this->assertFalse( $this->store->getSession( self::SESSIONID ) );
$backend->setProviderMetadata( null );
$this->assertNotFalse( $this->store->getSession( self::SESSIONID ) );
$this->assertSame( null, $backend->getProviderMetadata() );
@@ -321,11 +321,11 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
->onlyMethods( [ 'persistSession' ] )->getMock();
$this->provider->expects( $this->once() )->method( 'persistSession' );
$backend = $this->getBackend();
- $this->assertFalse( $backend->isPersistent(), 'sanity check' );
+ $this->assertFalse( $backend->isPersistent() );
$backend->save(); // This one shouldn't call $provider->persistSession()
$backend->persist();
- $this->assertTrue( $backend->isPersistent(), 'sanity check' );
+ $this->assertTrue( $backend->isPersistent() );
$this->provider = null;
$backend = $this->getBackend();
@@ -347,8 +347,8 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$wrap->dataDirty = true;
$backend->save(); // This one shouldn't call $provider->persistSession(), but should save
- $this->assertTrue( $backend->isPersistent(), 'sanity check' );
- $this->assertNotFalse( $this->store->getSession( self::SESSIONID ), 'sanity check' );
+ $this->assertTrue( $backend->isPersistent() );
+ $this->assertNotFalse( $this->store->getSession( self::SESSIONID ) );
$backend->unpersist();
$this->assertFalse( $backend->isPersistent() );
@@ -410,7 +410,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$this->provider = null;
$backend = $this->getBackend();
$this->assertTrue( $backend->canSetUser() );
- $this->assertNotSame( $user, $backend->getUser(), 'sanity check' );
+ $this->assertNotSame( $user, $backend->getUser() );
$backend->setUser( $user );
$this->assertSame( $user, $backend->getUser() );
}
@@ -471,12 +471,12 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$this->onSessionMetadataCalled = false;
$priv->metaDirty = true;
$backend->save();
- $this->assertTrue( $this->onSessionMetadataCalled, 'sanity check' );
+ $this->assertTrue( $this->onSessionMetadataCalled );
$this->onSessionMetadataCalled = false;
$priv->metaDirty = true;
$priv->autosave();
- $this->assertTrue( $this->onSessionMetadataCalled, 'sanity check' );
+ $this->assertTrue( $this->onSessionMetadataCalled );
$delay = $backend->delaySave();
@@ -534,7 +534,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$this->store->setSessionData( self::SESSIONID, $testData );
$backend = $this->getBackend( $user );
$this->store->deleteSession( self::SESSIONID );
- $this->assertFalse( $backend->isPersistent(), 'sanity check' );
+ $this->assertFalse( $backend->isPersistent() );
TestingAccessWrapper::newFromObject( $backend )->metaDirty = false;
TestingAccessWrapper::newFromObject( $backend )->dataDirty = false;
$backend->save();
@@ -550,7 +550,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$this->store->deleteSession( self::SESSIONID );
TestingAccessWrapper::newFromObject( $backend )->persist = false;
TestingAccessWrapper::newFromObject( $backend )->forcePersist = true;
- $this->assertFalse( $backend->isPersistent(), 'sanity check' );
+ $this->assertFalse( $backend->isPersistent() );
TestingAccessWrapper::newFromObject( $backend )->metaDirty = false;
TestingAccessWrapper::newFromObject( $backend )->dataDirty = false;
$backend->save();
@@ -566,7 +566,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$this->store->deleteSession( self::SESSIONID );
TestingAccessWrapper::newFromObject( $backend )->persist = false;
TestingAccessWrapper::newFromObject( $backend )->forcePersist = true;
- $this->assertFalse( $backend->isPersistent(), 'sanity check' );
+ $this->assertFalse( $backend->isPersistent() );
TestingAccessWrapper::newFromObject( $backend )->metaDirty = false;
TestingAccessWrapper::newFromObject( $backend )->dataDirty = false;
$backend->save();
@@ -579,7 +579,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$this->store->setSessionData( self::SESSIONID, $testData );
$backend = $this->getBackend( $user );
$this->store->deleteSession( self::SESSIONID );
- $this->assertFalse( $backend->isPersistent(), 'sanity check' );
+ $this->assertFalse( $backend->isPersistent() );
TestingAccessWrapper::newFromObject( $backend )->metaDirty = false;
TestingAccessWrapper::newFromObject( $backend )->dataDirty = true;
$backend->save();
@@ -601,7 +601,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$backend = $this->getBackend( $user );
$this->store->deleteSession( self::SESSIONID );
TestingAccessWrapper::newFromObject( $backend )->persist = true;
- $this->assertTrue( $backend->isPersistent(), 'sanity check' );
+ $this->assertTrue( $backend->isPersistent() );
TestingAccessWrapper::newFromObject( $backend )->metaDirty = false;
TestingAccessWrapper::newFromObject( $backend )->dataDirty = false;
$backend->save();
@@ -617,7 +617,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$this->store->deleteSession( self::SESSIONID );
TestingAccessWrapper::newFromObject( $backend )->persist = true;
TestingAccessWrapper::newFromObject( $backend )->forcePersist = true;
- $this->assertTrue( $backend->isPersistent(), 'sanity check' );
+ $this->assertTrue( $backend->isPersistent() );
TestingAccessWrapper::newFromObject( $backend )->metaDirty = false;
TestingAccessWrapper::newFromObject( $backend )->dataDirty = false;
$backend->save();
@@ -631,7 +631,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$backend = $this->getBackend( $user );
$this->store->deleteSession( self::SESSIONID );
TestingAccessWrapper::newFromObject( $backend )->persist = true;
- $this->assertTrue( $backend->isPersistent(), 'sanity check' );
+ $this->assertTrue( $backend->isPersistent() );
TestingAccessWrapper::newFromObject( $backend )->metaDirty = false;
TestingAccessWrapper::newFromObject( $backend )->dataDirty = true;
$backend->save();
@@ -657,7 +657,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$this->store->deleteSession( self::SESSIONID );
TestingAccessWrapper::newFromObject( $backend )->persist = true;
TestingAccessWrapper::newFromObject( $backend )->forcePersist = true;
- $this->assertTrue( $backend->isPersistent(), 'sanity check' );
+ $this->assertTrue( $backend->isPersistent() );
TestingAccessWrapper::newFromObject( $backend )->metaDirty = false;
TestingAccessWrapper::newFromObject( $backend )->dataDirty = true;
$backend->save();
@@ -682,7 +682,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$backend = $this->getBackend( $user );
$this->store->deleteSession( self::SESSIONID );
TestingAccessWrapper::newFromObject( $backend )->persist = true;
- $this->assertTrue( $backend->isPersistent(), 'sanity check' );
+ $this->assertTrue( $backend->isPersistent() );
TestingAccessWrapper::newFromObject( $backend )->metaDirty = true;
TestingAccessWrapper::newFromObject( $backend )->dataDirty = false;
$backend->save();
@@ -706,7 +706,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$backend = $this->getBackend( $user );
$this->store->deleteSession( self::SESSIONID );
TestingAccessWrapper::newFromObject( $backend )->persist = true;
- $this->assertTrue( $backend->isPersistent(), 'sanity check' );
+ $this->assertTrue( $backend->isPersistent() );
TestingAccessWrapper::newFromObject( $backend )->metaDirty = false;
TestingAccessWrapper::newFromObject( $backend )->dataDirty = false;
TestingAccessWrapper::newFromObject( $backend )->dataHash = 'Doesn\'t match';
@@ -756,7 +756,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$backend = $this->getBackend( $user );
$this->store->deleteSession( self::SESSIONID );
TestingAccessWrapper::newFromObject( $backend )->persist = true;
- $this->assertTrue( $backend->isPersistent(), 'sanity check' );
+ $this->assertTrue( $backend->isPersistent() );
TestingAccessWrapper::newFromObject( $backend )->metaDirty = true;
TestingAccessWrapper::newFromObject( $backend )->dataDirty = true;
$backend->save();
@@ -778,7 +778,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$backend = $this->getBackend( $user );
$this->store->deleteSession( self::SESSIONID );
$wrap = TestingAccessWrapper::newFromObject( $backend );
- $this->assertFalse( $backend->isPersistent(), 'sanity check' );
+ $this->assertFalse( $backend->isPersistent() );
$wrap->metaDirty = false;
$wrap->dataDirty = false;
$wrap->forcePersist = false;
@@ -805,7 +805,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$this->store->deleteSession( self::SESSIONID );
$wrap = TestingAccessWrapper::newFromObject( $backend );
$wrap->persist = true;
- $this->assertTrue( $backend->isPersistent(), 'sanity check' );
+ $this->assertTrue( $backend->isPersistent() );
$wrap->metaDirty = false;
$wrap->dataDirty = false;
$wrap->forcePersist = false;
@@ -831,7 +831,7 @@ class SessionBackendTest extends MediaWikiIntegrationTestCase {
$backend = $this->getBackend( $user );
$this->store->deleteSession( self::SESSIONID );
$wrap = TestingAccessWrapper::newFromObject( $backend );
- $this->assertFalse( $backend->isPersistent(), 'sanity check' );
+ $this->assertFalse( $backend->isPersistent() );
$wrap->metaDirty = false;
$wrap->dataDirty = false;
$wrap->forcePersist = false;
diff --git a/tests/phpunit/includes/session/SessionManagerTest.php b/tests/phpunit/includes/session/SessionManagerTest.php
index 5606724e61b9..3a9e074e8267 100644
--- a/tests/phpunit/includes/session/SessionManagerTest.php
+++ b/tests/phpunit/includes/session/SessionManagerTest.php
@@ -358,7 +358,7 @@ class SessionManagerTest extends MediaWikiIntegrationTestCase {
$this->assertTrue( $request->unpersist1 ); // The saving of the session does it
$this->assertFalse( $request->unpersist2 );
$session->persist();
- $this->assertTrue( $session->isPersistent(), 'sanity check' );
+ $this->assertTrue( $session->isPersistent() );
}
public function testGetSessionById() {
@@ -987,7 +987,7 @@ class SessionManagerTest extends MediaWikiIntegrationTestCase {
'id' => $id,
'userInfo' => $userInfo
] );
- $this->assertFalse( $info->isIdSafe(), 'sanity check' );
+ $this->assertFalse( $info->isIdSafe() );
$this->assertTrue( $loadSessionInfoFromStore( $info ) );
$this->assertFalse( $info->isIdSafe() );
$this->assertSame( [], $logger->getBuffer() );
@@ -996,7 +996,7 @@ class SessionManagerTest extends MediaWikiIntegrationTestCase {
'provider' => $provider,
'userInfo' => $userInfo
] );
- $this->assertTrue( $info->isIdSafe(), 'sanity check' );
+ $this->assertTrue( $info->isIdSafe() );
$this->assertTrue( $loadSessionInfoFromStore( $info ) );
$this->assertTrue( $info->isIdSafe() );
$this->assertSame( [], $logger->getBuffer() );
@@ -1006,7 +1006,7 @@ class SessionManagerTest extends MediaWikiIntegrationTestCase {
'id' => $id,
'userInfo' => $userInfo
] );
- $this->assertFalse( $info->isIdSafe(), 'sanity check' );
+ $this->assertFalse( $info->isIdSafe() );
$this->assertTrue( $loadSessionInfoFromStore( $info ) );
$this->assertTrue( $info->isIdSafe() );
$this->assertSame( [], $logger->getBuffer() );
@@ -1042,7 +1042,7 @@ class SessionManagerTest extends MediaWikiIntegrationTestCase {
'provider' => $provider,
'id' => $id,
] );
- $this->assertFalse( $info->isIdSafe(), 'sanity check' );
+ $this->assertFalse( $info->isIdSafe() );
$this->assertTrue( $loadSessionInfoFromStore( $info ) );
$this->assertInstanceOf( UserInfo::class, $info->getUserInfo() );
$this->assertTrue( $info->getUserInfo()->isVerified() );
@@ -1054,7 +1054,7 @@ class SessionManagerTest extends MediaWikiIntegrationTestCase {
'provider' => $provider2,
'id' => $id,
] );
- $this->assertFalse( $info->isIdSafe(), 'sanity check' );
+ $this->assertFalse( $info->isIdSafe() );
$this->assertFalse( $loadSessionInfoFromStore( $info ) );
$this->assertSame( [
[ LogLevel::INFO, 'Session "{session}": No user provided and provider cannot set user' ]
@@ -1116,7 +1116,7 @@ class SessionManagerTest extends MediaWikiIntegrationTestCase {
'id' => $id,
'userInfo' => $userInfo
] );
- $this->assertFalse( $info->isIdSafe(), 'sanity check' );
+ $this->assertFalse( $info->isIdSafe() );
$this->assertTrue( $loadSessionInfoFromStore( $info ) );
$this->assertTrue( $info->isIdSafe() );
$this->assertSame( [], $logger->getBuffer() );
@@ -1152,7 +1152,7 @@ class SessionManagerTest extends MediaWikiIntegrationTestCase {
'id' => $id,
'userInfo' => $userInfo
] );
- $this->assertFalse( $info->isIdSafe(), 'sanity check' );
+ $this->assertFalse( $info->isIdSafe() );
$this->assertTrue( $loadSessionInfoFromStore( $info ) );
$this->assertTrue( $info->isIdSafe() );
$this->assertSame( [], $logger->getBuffer() );
@@ -1255,7 +1255,7 @@ class SessionManagerTest extends MediaWikiIntegrationTestCase {
'provider' => $provider,
'id' => $id,
] );
- $this->assertFalse( $info->isIdSafe(), 'sanity check' );
+ $this->assertFalse( $info->isIdSafe() );
$this->assertTrue( $loadSessionInfoFromStore( $info ) );
$this->assertSame( $userInfo->getId(), $info->getUserInfo()->getId() );
$this->assertTrue( $info->isIdSafe() );
@@ -1269,7 +1269,7 @@ class SessionManagerTest extends MediaWikiIntegrationTestCase {
'provider' => $provider,
'id' => $id,
] );
- $this->assertFalse( $info->isIdSafe(), 'sanity check' );
+ $this->assertFalse( $info->isIdSafe() );
$this->assertTrue( $loadSessionInfoFromStore( $info ) );
$this->assertSame( $userInfo->getId(), $info->getUserInfo()->getId() );
$this->assertTrue( $info->isIdSafe() );
@@ -1283,7 +1283,7 @@ class SessionManagerTest extends MediaWikiIntegrationTestCase {
'provider' => $provider,
'id' => $id,
] );
- $this->assertFalse( $info->isIdSafe(), 'sanity check' );
+ $this->assertFalse( $info->isIdSafe() );
$this->assertTrue( $loadSessionInfoFromStore( $info ) );
$this->assertTrue( $info->getUserInfo()->isAnon() );
$this->assertTrue( $info->isIdSafe() );
@@ -1296,7 +1296,7 @@ class SessionManagerTest extends MediaWikiIntegrationTestCase {
'id' => $id,
'userInfo' => $unverifiedUserInfo
] );
- $this->assertFalse( $info->isIdSafe(), 'sanity check' );
+ $this->assertFalse( $info->isIdSafe() );
$this->assertTrue( $loadSessionInfoFromStore( $info ) );
$this->assertTrue( $info->getUserInfo()->isVerified() );
$this->assertSame( $unverifiedUserInfo->getId(), $info->getUserInfo()->getId() );
@@ -1311,7 +1311,7 @@ class SessionManagerTest extends MediaWikiIntegrationTestCase {
'id' => $id,
'userInfo' => $unverifiedUserInfo
] );
- $this->assertFalse( $info->isIdSafe(), 'sanity check' );
+ $this->assertFalse( $info->isIdSafe() );
$this->assertTrue( $loadSessionInfoFromStore( $info ) );
$this->assertTrue( $info->getUserInfo()->isVerified() );
$this->assertSame( $unverifiedUserInfo->getId(), $info->getUserInfo()->getId() );
diff --git a/tests/phpunit/includes/session/UserInfoTest.php b/tests/phpunit/includes/session/UserInfoTest.php
index b789316af93f..f54dddc9d22b 100644
--- a/tests/phpunit/includes/session/UserInfoTest.php
+++ b/tests/phpunit/includes/session/UserInfoTest.php
@@ -96,7 +96,7 @@ class UserInfoTest extends MediaWikiIntegrationTestCase {
// User name that does not exist should still be non-anon
$user = User::newFromName( 'DoesNotExist' );
- $this->assertSame( 0, $user->getId(), 'sanity check' );
+ $this->assertSame( 0, $user->getId(), 'User id is 0' );
$userinfo = UserInfo::newFromName( $user->getName() );
$this->assertFalse( $userinfo->isAnon() );
$this->assertFalse( $userinfo->isVerified() );
@@ -151,7 +151,7 @@ class UserInfoTest extends MediaWikiIntegrationTestCase {
// User name that does not exist should still be non-anon
$user = User::newFromName( 'DoesNotExist' );
- $this->assertSame( 0, $user->getId(), 'sanity check' );
+ $this->assertSame( 0, $user->getId() );
$userinfo = UserInfo::newFromUser( $user );
$this->assertFalse( $userinfo->isAnon() );
$this->assertFalse( $userinfo->isVerified() );
diff --git a/tests/phpunit/includes/site/CachingSiteStoreTest.php b/tests/phpunit/includes/site/CachingSiteStoreTest.php
index 10e1d89e6824..63d9062e0654 100644
--- a/tests/phpunit/includes/site/CachingSiteStoreTest.php
+++ b/tests/phpunit/includes/site/CachingSiteStoreTest.php
@@ -116,7 +116,7 @@ class CachingSiteStoreTest extends \MediaWikiIntegrationTestCase {
$store->getSite( 'enwiki' )->setLanguageCode( 'en-ca' );
// check: $store should have the new language code for 'enwiki'
- $this->assertEquals( 'en-ca', $store->getSite( 'enwiki' )->getLanguageCode(), 'sanity check' );
+ $this->assertEquals( 'en-ca', $store->getSite( 'enwiki' )->getLanguageCode() );
// purge cache
$store->reset();
diff --git a/tests/phpunit/includes/user/BotPasswordTest.php b/tests/phpunit/includes/user/BotPasswordTest.php
index a1f1e75102e4..2cafe5019f09 100644
--- a/tests/phpunit/includes/user/BotPasswordTest.php
+++ b/tests/phpunit/includes/user/BotPasswordTest.php
@@ -209,8 +209,8 @@ class BotPasswordTest extends MediaWikiIntegrationTestCase {
$bp1 = TestingAccessWrapper::newFromObject( BotPassword::newFromCentralId( 42, 'BotPassword' ) );
$bp2 = TestingAccessWrapper::newFromObject( BotPassword::newFromCentralId( 43, 'BotPassword' ) );
- $this->assertNotInstanceOf( InvalidPassword::class, $bp1->getPassword(), 'sanity check' );
- $this->assertNotInstanceOf( InvalidPassword::class, $bp2->getPassword(), 'sanity check' );
+ $this->assertNotInstanceOf( InvalidPassword::class, $bp1->getPassword() );
+ $this->assertNotInstanceOf( InvalidPassword::class, $bp2->getPassword() );
BotPassword::invalidateAllPasswordsForUser( $this->testUserName );
$this->assertInstanceOf( InvalidPassword::class, $bp1->getPassword() );
$this->assertNotInstanceOf( InvalidPassword::class, $bp2->getPassword() );
@@ -220,8 +220,8 @@ class BotPasswordTest extends MediaWikiIntegrationTestCase {
}
public function testRemoveAllPasswordsForUser() {
- $this->assertNotNull( BotPassword::newFromCentralId( 42, 'BotPassword' ), 'sanity check' );
- $this->assertNotNull( BotPassword::newFromCentralId( 43, 'BotPassword' ), 'sanity check' );
+ $this->assertNotNull( BotPassword::newFromCentralId( 42, 'BotPassword' ) );
+ $this->assertNotNull( BotPassword::newFromCentralId( 43, 'BotPassword' ) );
BotPassword::removeAllPasswordsForUser( $this->testUserName );
@@ -271,8 +271,7 @@ class BotPasswordTest extends MediaWikiIntegrationTestCase {
] );
$reset = MediaWiki\Session\TestUtils::setSessionManagerSingleton( $manager );
$this->assertNull(
- $manager->getProvider( MediaWiki\Session\BotPasswordSessionProvider::class ),
- 'sanity check'
+ $manager->getProvider( MediaWiki\Session\BotPasswordSessionProvider::class )
);
$status = BotPassword::login( "{$this->testUserName}@BotPassword", 'foobaz', new FauxRequest );
$this->assertEquals( Status::newFatal( 'botpasswords-no-provider' ), $status );
@@ -328,8 +327,7 @@ class BotPasswordTest extends MediaWikiIntegrationTestCase {
$request = new FauxRequest;
$this->assertNotInstanceOf(
MediaWiki\Session\BotPasswordSessionProvider::class,
- $request->getSession()->getProvider(),
- 'sanity check'
+ $request->getSession()->getProvider()
);
$status = BotPassword::login( "{$this->testUserName}@BotPassword", 'foobaz', $request );
$this->assertInstanceOf( Status::class, $status );
@@ -357,9 +355,9 @@ class BotPasswordTest extends MediaWikiIntegrationTestCase {
'restrictions' => MWRestrictions::newFromJson( '{"IPAddresses":["127.0.0.0/8"]}' ),
'grants' => [ 'test' ],
] );
- $this->assertFalse( $bp->isSaved(), 'sanity check' );
+ $this->assertFalse( $bp->isSaved() );
$this->assertNull(
- BotPassword::newFromCentralId( 42, 'TestSave', BotPassword::READ_LATEST ), 'sanity check'
+ BotPassword::newFromCentralId( 42, 'TestSave', BotPassword::READ_LATEST )
);
$passwordHash = $password ? $passwordFactory->newFromPlaintext( $password ) : null;
diff --git a/tests/phpunit/includes/user/ExternalUserNamesTest.php b/tests/phpunit/includes/user/ExternalUserNamesTest.php
index f95d0459dc2f..c54d10b38022 100644
--- a/tests/phpunit/includes/user/ExternalUserNamesTest.php
+++ b/tests/phpunit/includes/user/ExternalUserNamesTest.php
@@ -106,7 +106,7 @@ class ExternalUserNamesTest extends MediaWikiIntegrationTestCase {
public function testApplyPrefix_existingUser() {
$testName = $this->getTestUser()->getUser()->getName();
$testName2 = lcfirst( $testName );
- $this->assertNotSame( $testName, $testName2, 'sanity check' );
+ $this->assertNotSame( $testName, $testName2 );
$externalUserNames = new ExternalUserNames( 'p', false );
$this->assertSame( "p>$testName", $externalUserNames->applyPrefix( $testName ) );
diff --git a/tests/phpunit/includes/user/UserEditTrackerTest.php b/tests/phpunit/includes/user/UserEditTrackerTest.php
index 73e05151d58b..158a1fda6f78 100644
--- a/tests/phpunit/includes/user/UserEditTrackerTest.php
+++ b/tests/phpunit/includes/user/UserEditTrackerTest.php
@@ -149,7 +149,7 @@ class UserEditTrackerTest extends MediaWikiIntegrationTestCase {
$this->assertSame(
0,
DeferredUpdates::pendingUpdatesCount(),
- 'Sanity check: deferred updates ran'
+ 'deferred updates ran'
);
$editCountEnd = $tracker->getUserEditCount( $user );
diff --git a/tests/phpunit/includes/user/UserTest.php b/tests/phpunit/includes/user/UserTest.php
index b59869c6e032..241d8ee9d6ee 100644
--- a/tests/phpunit/includes/user/UserTest.php
+++ b/tests/phpunit/includes/user/UserTest.php
@@ -618,7 +618,7 @@ class UserTest extends MediaWikiIntegrationTestCase {
$request = new FauxRequest();
$request->setIP( '10.20.30.40' );
$this->setSessionUser( $this->user, $request );
- $this->assertFalse( $this->user->isAnon(), 'sanity check' );
+ $this->assertFalse( $this->user->isAnon() );
$this->assertNull( $this->user->getBlock() );
}
@@ -728,7 +728,7 @@ class UserTest extends MediaWikiIntegrationTestCase {
$this->assertGreaterThan(
0,
$userId,
- 'Sanity check: user has a working id'
+ 'user has a working id'
);
$otherUser = User::newFromId( $userId );
@@ -1006,7 +1006,7 @@ class UserTest extends MediaWikiIntegrationTestCase {
$this->assertNotSame(
$req1,
$req2,
- 'Sanity check: passing a request that does not match $wgRequest'
+ 'passing a request that does not match $wgRequest'
);
$user = User::newFromSession( $req2 );
$request = $user->getRequest();
@@ -1054,11 +1054,11 @@ class UserTest extends MediaWikiIntegrationTestCase {
// First, check the user isn't blocked
$user = $this->getMutableTestUser()->getUser();
$ut = Title::makeTitle( NS_USER_TALK, $user->getName() );
- $this->assertNull( $user->getBlock( false ), 'sanity check' );
- $this->assertSame( '', $user->blockedBy(), 'sanity check' );
- $this->assertSame( '', $user->blockedFor(), 'sanity check' );
- $this->assertFalse( $user->isHidden(), 'sanity check' );
- $this->assertFalse( $user->isBlockedFrom( $ut ), 'sanity check' );
+ $this->assertNull( $user->getBlock( false ) );
+ $this->assertSame( '', $user->blockedBy() );
+ $this->assertSame( '', $user->blockedFor() );
+ $this->assertFalse( $user->isHidden() );
+ $this->assertFalse( $user->isBlockedFrom( $ut ) );
// Block the user
$blocker = $this->getTestSysop()->getUser();
@@ -1071,7 +1071,7 @@ class UserTest extends MediaWikiIntegrationTestCase {
$block->setBlocker( $blocker );
$blockStore = MediaWikiServices::getInstance()->getDatabaseBlockStore();
$res = $blockStore->insertBlock( $block );
- $this->assertTrue( (bool)$res['id'], 'sanity check: Failed to insert block' );
+ $this->assertTrue( (bool)$res['id'], 'Failed to insert block' );
// Clear cache and confirm it loaded the block properly
$user->clearInstanceCache();