diff options
author | Reedy <reedy@wikimedia.org> | 2021-11-21 16:23:11 +0000 |
---|---|---|
committer | Reedy <reedy@wikimedia.org> | 2021-11-21 16:42:31 +0000 |
commit | 6e296116426e42aa57f8fa907158aa2552438cac (patch) | |
tree | 9f5ffe9d79c7f431e0314c401511d8440cece419 /tests | |
parent | 8965bd36e0dae178376ff678a436ab96101fb4a9 (diff) | |
download | mediawikicore-6e296116426e42aa57f8fa907158aa2552438cac.tar.gz mediawikicore-6e296116426e42aa57f8fa907158aa2552438cac.zip |
Remove or replace usages of "sanity"
Still some more to go...
Bug: T254646
Change-Id: Ia117f01e443c35b4765f3275cab4f2707e1be96f
Diffstat (limited to 'tests')
51 files changed, 101 insertions, 116 deletions
diff --git a/tests/phpunit/includes/EditPageConstraintsTest.php b/tests/phpunit/includes/EditPageConstraintsTest.php index ebb69e6146ba..3e85f36f6c54 100644 --- a/tests/phpunit/includes/EditPageConstraintsTest.php +++ b/tests/phpunit/includes/EditPageConstraintsTest.php @@ -90,7 +90,6 @@ class EditPageConstraintsTest extends MediaWikiLangTestCase { ); $page->clear(); - // sanity check $content = $page->getContent(); $this->assertInstanceOf( TextContent::class, $content ); $currentText = $content->getText(); diff --git a/tests/phpunit/includes/Permissions/PermissionManagerTest.php b/tests/phpunit/includes/Permissions/PermissionManagerTest.php index c931de31754a..cc84c86559f3 100644 --- a/tests/phpunit/includes/Permissions/PermissionManagerTest.php +++ b/tests/phpunit/includes/Permissions/PermissionManagerTest.php @@ -1116,7 +1116,7 @@ class PermissionManagerTest extends MediaWikiLangTestCase { public function testAddTemporaryUserRights() { $permissionManager = MediaWikiServices::getInstance()->getPermissionManager(); $this->overrideUserPermissions( $this->user, [ 'read', 'edit' ] ); - // sanity checks + $this->assertEquals( [ 'read', 'edit' ], $permissionManager->getUserPermissions( $this->user ) ); $this->assertFalse( $permissionManager->userHasRight( $this->user, 'move' ) ); diff --git a/tests/phpunit/includes/Revision/ContributionsLookupTest.php b/tests/phpunit/includes/Revision/ContributionsLookupTest.php index 3347d3e963c6..cba3ce82cd95 100644 --- a/tests/phpunit/includes/Revision/ContributionsLookupTest.php +++ b/tests/phpunit/includes/Revision/ContributionsLookupTest.php @@ -368,7 +368,6 @@ class ContributionsLookupTest extends MediaWikiIntegrationTestCase { __METHOD__ ); - // sanity $this->assertSame( 2, $this->db->affectedRows() ); // anons should not see suppressed contribs diff --git a/tests/phpunit/includes/Revision/RevisionStoreDbTest.php b/tests/phpunit/includes/Revision/RevisionStoreDbTest.php index 4923f42a7260..4c2f8d304010 100644 --- a/tests/phpunit/includes/Revision/RevisionStoreDbTest.php +++ b/tests/phpunit/includes/Revision/RevisionStoreDbTest.php @@ -996,7 +996,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { public function testGetLatestKnownRevision_foreigh() { $page = $this->getTestPage(); $status = $this->editPage( $page, __METHOD__ ); - $this->assertTrue( $status->isGood(), 'Sanity: edited a page' ); + $this->assertTrue( $status->isGood(), 'edited a page' ); /** @var RevisionRecord $revRecord */ $revRecord = $status->value['revision-record']; $dbDomain = 'some_foreign_wiki'; @@ -2295,13 +2295,13 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { $page1 = $this->getTestPage(); $text = __METHOD__ . 'b-ä'; $editStatus = $this->editPage( $page1->getTitle()->getPrefixedDBkey(), $text . '1' ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 1' ); + $this->assertTrue( $editStatus->isGood(), 'must create revision 1' ); /** @var RevisionRecord $revRecord1 */ $revRecord1 = $editStatus->getValue()['revision-record']; $page2 = $this->getTestPage( $page1->getTitle()->getPrefixedText() . '_other' ); $editStatus = $this->editPage( $page2->getTitle()->getPrefixedDBkey(), $text . '2' ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 2' ); + $this->assertTrue( $editStatus->isGood(), 'must create revision 2' ); /** @var RevisionRecord $revRecord2 */ $revRecord2 = $editStatus->getValue()['revision-record']; @@ -2354,14 +2354,14 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { $page1 = $this->getTestPage( __METHOD__ ); $text = __METHOD__ . 'b-ä'; $editStatus = $this->editPage( $page1->getTitle()->getPrefixedDBkey(), $text . '1' ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 1' ); + $this->assertTrue( $editStatus->isGood(), 'must create revision 1' ); /** @var RevisionRecord $revRecord1 */ $revRecord1 = $editStatus->getValue()['revision-record']; $page1->doDeleteArticleReal( __METHOD__, $this->getTestSysop()->getUser() ); $page2 = $this->getTestPage( $page1->getTitle()->getPrefixedText() . '_other' ); $editStatus = $this->editPage( $page2->getTitle()->getPrefixedDBkey(), $text . '2' ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 2' ); + $this->assertTrue( $editStatus->isGood(), 'must create revision 2' ); /** @var RevisionRecord $revRecord2 */ $revRecord2 = $editStatus->getValue()['revision-record']; $page2->doDeleteArticleReal( __METHOD__, $this->getTestSysop()->getUser() ); @@ -2483,13 +2483,13 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { $page1 = $this->getTestPage(); $text = __METHOD__ . 'b-ä'; $editStatus = $this->editPage( $page1->getTitle()->getPrefixedDBkey(), $text . '1' ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 1' ); + $this->assertTrue( $editStatus->isGood(), 'must create revision 1' ); /** @var RevisionRecord $revRecord1 */ $revRecord1 = $editStatus->getValue()['revision-record']; $page2 = $this->getTestPage( $otherPageTitle ); $editStatus = $this->editPage( $page2->getTitle()->getPrefixedDBkey(), $text . '2' ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 2' ); + $this->assertTrue( $editStatus->isGood(), 'must create revision 2' ); /** @var RevisionRecord $revRecord2 */ $revRecord2 = $editStatus->getValue()['revision-record']; @@ -2644,7 +2644,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { $page1 = $this->getTestPage(); $text = __METHOD__ . 'b-ä'; $editStatus = $this->editPage( $page1->getTitle()->getPrefixedDBkey(), $text . '1' ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 1' ); + $this->assertTrue( $editStatus->isGood(), 'must create revision 1' ); /** @var RevisionRecord $rev1 */ $revRecord1 = $editStatus->getValue()['revision-record']; @@ -2665,7 +2665,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { $page1 = $this->getTestPage(); $text = __METHOD__ . 'b-ä'; $editStatus = $this->editPage( $page1->getTitle()->getPrefixedDBkey(), $text . '1' ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 1' ); + $this->assertTrue( $editStatus->isGood(), 'must create revision 1' ); /** @var RevisionRecord $revRecord1 */ $revRecord1 = $editStatus->getValue()['revision-record']; @@ -2692,7 +2692,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { $revisionIds = []; for ( $revNum = 0; $revNum < $NUM; $revNum++ ) { $editStatus = $this->editPage( $page->getTitle()->getPrefixedDBkey(), 'Revision ' . $revNum ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision ' . $revNum ); + $this->assertTrue( $editStatus->isGood(), 'must create revision ' . $revNum ); $newRevision = $editStatus->getValue()['revision-record']; /** @var RevisionRecord $newRevision */ $revisions[] = $newRevision; @@ -2789,7 +2789,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { $revisions = []; for ( $revNum = 0; $revNum < $NUM; $revNum++ ) { $editStatus = $this->editPage( $page->getTitle()->getPrefixedDBkey(), 'Revision ' . $revNum ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision ' . $revNum ); + $this->assertTrue( $editStatus->isGood(), 'must create revision ' . $revNum ); $revisions[] = $editStatus->getValue()['revision-record']; } @@ -2845,7 +2845,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { '', NS_MAIN, $users[$revNum] ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision ' . $revNum ); + $this->assertTrue( $editStatus->isGood(), 'must create revision ' . $revNum ); $revisions[] = $editStatus->getValue()['revision-record']; } @@ -2894,10 +2894,10 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { $page1 = $this->getTestPage( __METHOD__ ); $page2 = $this->getTestPage( 'Other_Page' ); $editStatus = $this->editPage( $page1->getTitle()->getPrefixedDBkey(), 'Revision 1' ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 1' ); + $this->assertTrue( $editStatus->isGood(), 'must create revision 1' ); $rev1 = $editStatus->getValue()['revision-record']; $editStatus = $this->editPage( $page2->getTitle()->getPrefixedDBkey(), 'Revision 1' ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 1' ); + $this->assertTrue( $editStatus->isGood(), 'must create revision 1' ); $rev2 = $editStatus->getValue()['revision-record']; $this->expectException( InvalidArgumentException::class ); @@ -2933,14 +2933,14 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { public function testGetFirstRevision( $getPageIdentity ) { list( $pageTitle, $pageIdentity ) = $getPageIdentity(); $editStatus = $this->editPage( $pageTitle->getPrefixedDBkey(), 'First Revision' ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create first revision' ); + $this->assertTrue( $editStatus->isGood(), 'must create first revision' ); $firstRevId = $editStatus->getValue()['revision-record']->getID(); $editStatus = $this->editPage( $pageTitle->getPrefixedText(), 'New Revision' ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create new revision' ); + $this->assertTrue( $editStatus->isGood(), 'must create new revision' ); $this->assertNotSame( $firstRevId, $editStatus->getValue()['revision-record']->getID(), - 'Sanity: new revision must have different id' + 'new revision must have different id' ); $this->assertSame( $firstRevId, @@ -3116,7 +3116,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { $page1 = $this->getTestPage(); $text = __METHOD__ . 'b-ä'; $editStatus = $this->editPage( $page1->getTitle()->getPrefixedDBkey(), $text . '1' ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 1' ); + $this->assertTrue( $editStatus->isGood(), 'must create revision 1' ); /** @var RevisionRecord $revRecord1 */ $revRecord1 = $editStatus->getValue()['revision-record']; @@ -3169,7 +3169,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { $page1 = $this->getTestPage(); $text = __METHOD__ . 'b-ä'; $editStatus = $this->editPage( $page1->getTitle()->getPrefixedDBkey(), $text . '1' ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 1' ); + $this->assertTrue( $editStatus->isGood(), 'must create revision 1' ); /** @var RevisionRecord $revRecord1 */ $revRecord1 = $editStatus->getValue()['revision-record']; @@ -3252,7 +3252,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { $page1 = $this->getTestPage(); $text = __METHOD__ . 'b-ä'; $editStatus = $this->editPage( $page1->getTitle()->getPrefixedDBkey(), $text . '1' ); - $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 1' ); + $this->assertTrue( $editStatus->isGood(), 'must create revision 1' ); /** @var RevisionRecord $revRecord1 */ $revRecord1 = $editStatus->getValue()['revision-record']; @@ -3298,13 +3298,13 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase { // Prepare a page with 3 revisions $page = $this->getExistingTestPage( __METHOD__ ); $status = $this->editPage( $page, 'Content 1' ); - $this->assertTrue( $status->isGood(), 'Sanity: edit 1' ); + $this->assertTrue( $status->isGood(), 'edit 1' ); $originalRev = $status->value[ 'revision-record' ]; - $this->assertTrue( $this->editPage( $page, 'Content 2' )->isGood(), 'Sanity: edit 2' ); + $this->assertTrue( $this->editPage( $page, 'Content 2' )->isGood(), 'edit 2' ); $status = $this->editPage( $page, 'Content 1' ); - $this->assertTrue( $status->isGood(), 'Sanity: edit 3' ); + $this->assertTrue( $status->isGood(), 'edit 3' ); $latestRev = $status->value[ 'revision-record' ]; $store = $this->getServiceContainer()->getRevisionStore(); diff --git a/tests/phpunit/includes/TitleTest.php b/tests/phpunit/includes/TitleTest.php index 6c24cd3c8038..7501ca9b7b8d 100644 --- a/tests/phpunit/includes/TitleTest.php +++ b/tests/phpunit/includes/TitleTest.php @@ -696,7 +696,7 @@ class TitleTest extends MediaWikiIntegrationTestCase { $existingTitle1 = $existingPage1->getTitle(); $existingId1 = $existingTitle1->getId(); - $this->assertGreaterThan( 0, $existingId1, 'Sanity: Existing test page should have a positive id' ); + $this->assertGreaterThan( 0, $existingId1, 'Existing test page should have a positive id' ); $newFromId1 = Title::newFromID( $existingId1 ); $this->assertInstanceOf( Title::class, $newFromId1, 'newFromID returns a title for an existing id' ); @@ -710,7 +710,7 @@ class TitleTest extends MediaWikiIntegrationTestCase { $existingTitle2 = $existingPage2->getTitle(); $existingId2 = $existingTitle2->getId(); - $this->assertGreaterThan( 0, $existingId2, 'Sanity: Existing test page should have a positive id' ); + $this->assertGreaterThan( 0, $existingId2, 'Existing test page should have a positive id' ); $newFromId2 = Title::newFromID( $existingId2 ); $this->assertInstanceOf( Title::class, $newFromId2, 'newFromID returns a title for an existing id' ); diff --git a/tests/phpunit/includes/api/ApiBaseTest.php b/tests/phpunit/includes/api/ApiBaseTest.php index 762d2a75a674..4409cf83c1e1 100644 --- a/tests/phpunit/includes/api/ApiBaseTest.php +++ b/tests/phpunit/includes/api/ApiBaseTest.php @@ -1312,7 +1312,7 @@ class ApiBaseTest extends ApiTestCase { $msg = new Message( 'mainpage' ); - // Sanity check empty array + // Check empty array $expect = Status::newGood(); $this->assertEquals( $expect, $mock->errorArrayToStatus( [] ) ); @@ -1375,7 +1375,7 @@ class ApiBaseTest extends ApiTestCase { $msg = new Message( 'mainpage' ); - // Sanity check empty array + // Check empty array $expect = Status::newGood(); $test = Status::newGood(); $mock->addBlockInfoToStatus( $test ); diff --git a/tests/phpunit/includes/api/ApiEditPageTest.php b/tests/phpunit/includes/api/ApiEditPageTest.php index 3c735b07708f..d1d779048a47 100644 --- a/tests/phpunit/includes/api/ApiEditPageTest.php +++ b/tests/phpunit/includes/api/ApiEditPageTest.php @@ -142,7 +142,7 @@ class ApiEditPageTest extends ApiTestCase { 'title' => $name, 'text' => $text, ] ); - $this->assertSame( 'Success', $re['edit']['result'] ); // sanity + $this->assertSame( 'Success', $re['edit']['result'] ); } // -- try append/prepend -------------------------------------------- diff --git a/tests/phpunit/includes/api/ApiMainTest.php b/tests/phpunit/includes/api/ApiMainTest.php index 5536a9bba343..daefc0cf753f 100644 --- a/tests/phpunit/includes/api/ApiMainTest.php +++ b/tests/phpunit/includes/api/ApiMainTest.php @@ -447,7 +447,7 @@ class ApiMainTest extends ApiTestCase { * Test that 'assert' is processed before module errors */ public function testAssertBeforeModule() { - // Sanity check that the query without assert throws too-many-titles + // Check that the query without assert throws too-many-titles try { $this->doApiRequest( [ 'action' => 'query', diff --git a/tests/phpunit/includes/api/ApiParseTest.php b/tests/phpunit/includes/api/ApiParseTest.php index b9bf2d2425e3..97bcad57f525 100644 --- a/tests/phpunit/includes/api/ApiParseTest.php +++ b/tests/phpunit/includes/api/ApiParseTest.php @@ -592,7 +592,7 @@ class ApiParseTest extends ApiTestCase { 'prop' => 'headhtml', ] ); - // Just do a rough sanity check + // Just do a rough check $this->assertRegExp( '#<!DOCTYPE.*<html.*<head.*</head>.*<body#s', $res[0]['parse']['headhtml'] ); $this->assertArrayNotHasKey( 'warnings', $res[0] ); diff --git a/tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php b/tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php index bdfd6b27922c..1ab0c72b6e3a 100644 --- a/tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php +++ b/tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php @@ -475,7 +475,6 @@ class LocalPasswordPrimaryAuthenticationProviderTest extends \MediaWikiIntegrati $provider = $this->getProvider( $loginOnly ); - // Sanity check $loginReq = new PasswordAuthenticationRequest(); $loginReq->action = AuthManager::ACTION_LOGIN; $loginReq->username = $user; diff --git a/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php b/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php index cbe8a9ec9a7c..9f02ce905bba 100644 --- a/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php +++ b/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php @@ -457,7 +457,6 @@ class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiInteg $provider = $this->getProvider(); - // Sanity check $loginReq = new PasswordAuthenticationRequest(); $loginReq->action = AuthManager::ACTION_CHANGE; $loginReq->username = $user; diff --git a/tests/phpunit/includes/block/BlockManagerTest.php b/tests/phpunit/includes/block/BlockManagerTest.php index 2157920f1754..d52e6041fca0 100644 --- a/tests/phpunit/includes/block/BlockManagerTest.php +++ b/tests/phpunit/includes/block/BlockManagerTest.php @@ -107,7 +107,7 @@ class BlockManagerTest extends MediaWikiIntegrationTestCase { $this->assertTrue( $onUserGetRightsCalled, 'Extensions should be able to grant rights' ); $this->assertTrue( $onGetUserBlockCalled, - 'Sanity check: HookRunner::onGetUserBlock should have been called' + 'Check that HookRunner::onGetUserBlock was called' ); $this->assertNull( $onGetUserBlockIP, diff --git a/tests/phpunit/includes/block/DatabaseBlockTest.php b/tests/phpunit/includes/block/DatabaseBlockTest.php index b001efe1cb32..1802ec98203c 100644 --- a/tests/phpunit/includes/block/DatabaseBlockTest.php +++ b/tests/phpunit/includes/block/DatabaseBlockTest.php @@ -218,11 +218,10 @@ class DatabaseBlockTest extends MediaWikiLangTestCase { $u = User::newFromName( $username ); $u->addToDatabase(); $userId = $u->getId(); - $this->assertNotEquals( 0, $userId, 'sanity' ); + $this->assertNotEquals( 0, $userId, 'Check user id is not 0' ); TestUser::setPasswordForUser( $u, 'NotRandomPass' ); unset( $u ); - // Sanity check $this->assertNull( DatabaseBlock::newFromTarget( $username ), "$username should not be blocked" @@ -290,7 +289,7 @@ class DatabaseBlockTest extends MediaWikiLangTestCase { $user = User::newFromName( 'UserOnForeignWiki' ); $user->addToDatabase(); $userId = $user->getId(); - $this->assertNotEquals( 0, $userId, 'sanity' ); + $this->assertNotEquals( 0, $userId, 'Check user id is not 0' ); // Foreign perspective (blockee not on current wiki)... $blockOptions = [ diff --git a/tests/phpunit/includes/cache/MessageCacheTest.php b/tests/phpunit/includes/cache/MessageCacheTest.php index 80846101072a..1543748a94e2 100644 --- a/tests/phpunit/includes/cache/MessageCacheTest.php +++ b/tests/phpunit/includes/cache/MessageCacheTest.php @@ -80,7 +80,6 @@ class MessageCacheTest extends MediaWikiLangTestCase { ->setContent( SlotRecord::MAIN, $content ) ->saveRevision( $summary ); - // sanity $this->assertNotNull( $newRevision, 'Create page ' . $title->getPrefixedDBkey() ); return $newRevision; } diff --git a/tests/phpunit/includes/db/LoadBalancerTest.php b/tests/phpunit/includes/db/LoadBalancerTest.php index 2c620fc8264b..704f84c89ea6 100644 --- a/tests/phpunit/includes/db/LoadBalancerTest.php +++ b/tests/phpunit/includes/db/LoadBalancerTest.php @@ -360,7 +360,7 @@ class LoadBalancerTest extends MediaWikiIntegrationTestCase { // statements such as CREATE TABLE. $useAtomicSection = in_array( $db->getType(), [ 'sqlite', 'postgres' ], true ); try { - $db->dropTable( 'some_table' ); // clear for sanity + $db->dropTable( 'some_table' ); $this->assertNotEquals( $db::STATUS_TRX_ERROR, $db->trxStatus() ); if ( $useAtomicSection ) { diff --git a/tests/phpunit/includes/deferred/RefreshSecondaryDataUpdateTest.php b/tests/phpunit/includes/deferred/RefreshSecondaryDataUpdateTest.php index 6771c5d7b81b..13144860b79e 100644 --- a/tests/phpunit/includes/deferred/RefreshSecondaryDataUpdateTest.php +++ b/tests/phpunit/includes/deferred/RefreshSecondaryDataUpdateTest.php @@ -176,7 +176,6 @@ class RefreshSecondaryDataUpdateTest extends MediaWikiIntegrationTestCase { $dbw->setFlag( DBO_TRX, $dbw::REMEMBER_PRIOR ); // make queries trigger TRX $reset = new ScopedCallback( [ $dbw, 'restoreFlags' ] ); - // Sanity check $this->assertSame( 0, $dbw->trxLevel() ); $dbw->selectRow( 'page', '*', '', __METHOD__ ); if ( !$dbw->trxLevel() ) { diff --git a/tests/phpunit/includes/diff/DifferenceEngineTest.php b/tests/phpunit/includes/diff/DifferenceEngineTest.php index bfb20d96663b..c4630a52a454 100644 --- a/tests/phpunit/includes/diff/DifferenceEngineTest.php +++ b/tests/phpunit/includes/diff/DifferenceEngineTest.php @@ -341,9 +341,9 @@ class DifferenceEngineTest extends MediaWikiIntegrationTestCase { } $page = $this->getNonExistingTestPage( 'Page1' ); - $this->assertTrue( $this->editPage( $page, 'Edit1' )->isGood(), 'Sanity: edited a page' ); + $this->assertTrue( $this->editPage( $page, 'Edit1' )->isGood(), 'edited a page' ); $rev1 = $page->getRevisionRecord(); - $this->assertTrue( $this->editPage( $page, 'Edit2' )->isGood(), 'Sanity: edited a page' ); + $this->assertTrue( $this->editPage( $page, 'Edit2' )->isGood(), 'edited a page' ); $rev2 = $page->getRevisionRecord(); $diffEngine = new DifferenceEngine( $this->context ); diff --git a/tests/phpunit/includes/filerepo/file/LocalFileTest.php b/tests/phpunit/includes/filerepo/file/LocalFileTest.php index 53a44d10b788..3288510f9643 100644 --- a/tests/phpunit/includes/filerepo/file/LocalFileTest.php +++ b/tests/phpunit/includes/filerepo/file/LocalFileTest.php @@ -380,7 +380,7 @@ class LocalFileTest extends MediaWikiIntegrationTestCase { $this->getServiceContainer()->getRepoGroup()->getLocalRepo(), '20201105235242' ); - $this->assertInstanceOf( File::class, $file, 'Sanity: created a test file' ); + $this->assertInstanceOf( File::class, $file, 'Created a test file' ); return $file; } diff --git a/tests/phpunit/includes/htmlform/HTMLRestrictionsFieldTest.php b/tests/phpunit/includes/htmlform/HTMLRestrictionsFieldTest.php index d6cbe9ff5ea1..5a3ac02a22d0 100644 --- a/tests/phpunit/includes/htmlform/HTMLRestrictionsFieldTest.php +++ b/tests/phpunit/includes/htmlform/HTMLRestrictionsFieldTest.php @@ -55,7 +55,6 @@ class HTMLRestrictionsFieldTest extends PHPUnit\Framework\TestCase { $this->assertEquals( $value, $restrictions->toArray()['IPAddresses'] ); } - // sanity $form->getHTML( $status ); } diff --git a/tests/phpunit/includes/import/ImportExportTest.php b/tests/phpunit/includes/import/ImportExportTest.php index 6cd95b07fa2a..a52936e563d3 100644 --- a/tests/phpunit/includes/import/ImportExportTest.php +++ b/tests/phpunit/includes/import/ImportExportTest.php @@ -253,7 +253,6 @@ class ImportExportTest extends MediaWikiLangTestCase { $asserter->setVarMapping( $key, $value ); } - // sanity check $dumpData = file_get_contents( $tmpFile ); $this->assertNotEmpty( $dumpData, 'Dump XML' ); diff --git a/tests/phpunit/includes/jobqueue/JobRunnerTest.php b/tests/phpunit/includes/jobqueue/JobRunnerTest.php index 655223faf281..735a49a891a3 100644 --- a/tests/phpunit/includes/jobqueue/JobRunnerTest.php +++ b/tests/phpunit/includes/jobqueue/JobRunnerTest.php @@ -31,7 +31,7 @@ class JobRunnerTest extends MediaWikiIntegrationTestCase { $str = wfRandomString( 10 ); $this->page = $this->insertPage( $str )['title']; - $this->assertTrue( $this->page->exists(), 'Sanity: The created page exists' ); + $this->assertTrue( $this->page->exists(), 'The created page exists' ); $this->jobRunner = MediaWikiServices::getInstance()->getJobRunner(); $jobParams = [ diff --git a/tests/phpunit/includes/page/ArticleTest.php b/tests/phpunit/includes/page/ArticleTest.php index 26e0481f6c56..b1cabbf5897d 100644 --- a/tests/phpunit/includes/page/ArticleTest.php +++ b/tests/phpunit/includes/page/ArticleTest.php @@ -104,7 +104,7 @@ class ArticleTest extends \MediaWikiIntegrationTestCase { if ( $editPageText !== null ) { $editedUser = $isEditedBySameUser ? $user1 : $user2; $editIsGood = $this->editPage( $article->getPage(), $editPageText, '', NS_MAIN, $editedUser )->isGood(); - $this->assertTrue( $editIsGood, 'Sanity: edited a page' ); + $this->assertTrue( $editIsGood, 'edited a page' ); } $this->assertSame( $expectedResult, $article->showPatrolFooter() ); } diff --git a/tests/phpunit/includes/page/ParserOutputAccessTest.php b/tests/phpunit/includes/page/ParserOutputAccessTest.php index f49f2ab6f454..9c5fd9caeb09 100644 --- a/tests/phpunit/includes/page/ParserOutputAccessTest.php +++ b/tests/phpunit/includes/page/ParserOutputAccessTest.php @@ -345,7 +345,7 @@ class ParserOutputAccessTest extends MediaWikiIntegrationTestCase { $frenchResult = $access->getParserOutput( $page, $frenchOptions ); $this->assertContainsHtml( 'Test', $frenchResult ); - // sanity check that French output was cached + // Check that French output was cached $cachedFrenchOutput = $access->getCachedParserOutput( $page, $frenchOptions ); $this->assertNotNull( $cachedFrenchOutput, 'French output should be in the cache' ); @@ -531,7 +531,7 @@ class ParserOutputAccessTest extends MediaWikiIntegrationTestCase { $frenchResult = $access->getParserOutput( $page, $frenchOptions, $oldRev ); $this->assertContainsHtml( 'Test', $frenchResult ); - // sanity check that French output was cached + // Check that French output was cached $cachedFrenchOutput = $access->getCachedParserOutput( $page, $frenchOptions, $oldRev ); $this->assertNotNull( $cachedFrenchOutput, 'French output should be in the cache' ); diff --git a/tests/phpunit/includes/page/WikiPageDbTest.php b/tests/phpunit/includes/page/WikiPageDbTest.php index f8e08273960e..9ac77ca5ff2b 100644 --- a/tests/phpunit/includes/page/WikiPageDbTest.php +++ b/tests/phpunit/includes/page/WikiPageDbTest.php @@ -916,7 +916,7 @@ class WikiPageDbTest extends MediaWikiLangTestCase { $page = $this->createPage( $title, $text, $model ); - # sanity check, because this test seems to fail for no reason for some people. + # double check, because this test seems to fail for no reason for some people. $c = $page->getContent(); $this->assertEquals( WikitextContent::class, get_class( $c ) ); diff --git a/tests/phpunit/includes/registration/ExtensionRegistryTest.php b/tests/phpunit/includes/registration/ExtensionRegistryTest.php index a752d2e8f693..ecbf253565b0 100644 --- a/tests/phpunit/includes/registration/ExtensionRegistryTest.php +++ b/tests/phpunit/includes/registration/ExtensionRegistryTest.php @@ -437,7 +437,7 @@ class ExtensionRegistryTest extends MediaWikiIntegrationTestCase { $registry = new ExtensionRegistry(); $registry->queue( "{$this->dataDir}/good.json" ); $registry->loadFromQueue(); - // Sanity check that it worked + // Check that it worked $this->assertSame( [ 'test' ], $registry->getAttribute( 'FooBarAttr' ) ); $reset = $registry->setAttributeForTest( 'FooBarAttr', [ 'override' ] ); // overridden properly diff --git a/tests/phpunit/includes/shell/ShellTest.php b/tests/phpunit/includes/shell/ShellTest.php index ef966abf09fc..fa6cb906f405 100644 --- a/tests/phpunit/includes/shell/ShellTest.php +++ b/tests/phpunit/includes/shell/ShellTest.php @@ -10,7 +10,7 @@ use MediaWiki\Shell\Shell; class ShellTest extends MediaWikiIntegrationTestCase { public function testIsDisabled() { - $this->assertIsBool( Shell::isDisabled() ); // sanity + $this->assertIsBool( Shell::isDisabled() ); } /** diff --git a/tests/phpunit/includes/site/CachingSiteStoreTest.php b/tests/phpunit/includes/site/CachingSiteStoreTest.php index abbfaf6f5196..10e1d89e6824 100644 --- a/tests/phpunit/includes/site/CachingSiteStoreTest.php +++ b/tests/phpunit/includes/site/CachingSiteStoreTest.php @@ -115,7 +115,7 @@ class CachingSiteStoreTest extends \MediaWikiIntegrationTestCase { $store->getSite( 'enwiki' )->setLanguageCode( 'en-ca' ); - // sanity check: $store should have the new language code for 'enwiki' + // check: $store should have the new language code for 'enwiki' $this->assertEquals( 'en-ca', $store->getSite( 'enwiki' )->getLanguageCode(), 'sanity check' ); // purge cache diff --git a/tests/phpunit/includes/site/DBSiteStoreTest.php b/tests/phpunit/includes/site/DBSiteStoreTest.php index c1c5f545072c..b69c9f81379c 100644 --- a/tests/phpunit/includes/site/DBSiteStoreTest.php +++ b/tests/phpunit/includes/site/DBSiteStoreTest.php @@ -116,7 +116,7 @@ class DBSiteStoreTest extends MediaWikiIntegrationTestCase { // cache in $store1, but not the internal cache in store2. $this->assertTrue( $store1->clear() ); - // sanity check: $store2 should have a stale cache now + // check: $store2 should have a stale cache now $this->assertNotNull( $store2->getSite( 'enwiki' ) ); // purge cache diff --git a/tests/phpunit/includes/specials/SpecialContributionsTest.php b/tests/phpunit/includes/specials/SpecialContributionsTest.php index 46f5c9acb549..0af99d1c50f7 100644 --- a/tests/phpunit/includes/specials/SpecialContributionsTest.php +++ b/tests/phpunit/includes/specials/SpecialContributionsTest.php @@ -30,7 +30,7 @@ class SpecialContributionsTest extends SpecialPageTestBase { $this->editPage( $this->pageName, 'Test Content', 'test', NS_MAIN, $this->admin )->isOK(), - 'Sanity: admin contributed' + 'Admin contributed' ); } diff --git a/tests/phpunit/includes/specials/SpecialGoToInterwikiTest.php b/tests/phpunit/includes/specials/SpecialGoToInterwikiTest.php index a4ff113c0445..52dc18b89dba 100644 --- a/tests/phpunit/includes/specials/SpecialGoToInterwikiTest.php +++ b/tests/phpunit/includes/specials/SpecialGoToInterwikiTest.php @@ -22,12 +22,11 @@ class SpecialGoToInterwikiTest extends MediaWikiIntegrationTestCase { MediaWikiServices::getInstance()->resetServiceForTesting( 'TitleParser' ); MediaWikiServices::getInstance()->resetServiceForTesting( '_MediaWikiTitleCodec' ); - // sanity check - $this->assertTrue( !Title::newFromText( 'Foo' )->isExternal() ); + $this->assertNotTrue( Title::newFromText( 'Foo' )->isExternal() ); $this->assertTrue( Title::newFromText( 'local:Foo' )->isExternal() ); $this->assertTrue( Title::newFromText( 'nonlocal:Foo' )->isExternal() ); $this->assertTrue( Title::newFromText( 'local:Foo' )->isLocal() ); - $this->assertTrue( !Title::newFromText( 'nonlocal:Foo' )->isLocal() ); + $this->assertNotTrue( Title::newFromText( 'nonlocal:Foo' )->isLocal() ); $goToInterwiki = MediaWikiServices::getInstance()->getSpecialPageFactory() ->getPage( 'GoToInterwiki' ); diff --git a/tests/phpunit/includes/user/TalkPageNotificationManagerTest.php b/tests/phpunit/includes/user/TalkPageNotificationManagerTest.php index 7222e50f2ffc..ca56ae17446d 100644 --- a/tests/phpunit/includes/user/TalkPageNotificationManagerTest.php +++ b/tests/phpunit/includes/user/TalkPageNotificationManagerTest.php @@ -35,7 +35,7 @@ class TalkPageNotificationManagerTest extends MediaWikiIntegrationTestCase { NS_MAIN, $this->getTestSysop()->getUser() ); - $this->assertTrue( $status->isGood(), 'Sanity: create revision of user talk' ); + $this->assertTrue( $status->isGood(), 'create revision of user talk' ); return $status->getValue()['revision-record']; } diff --git a/tests/phpunit/includes/user/UserGroupManagerTest.php b/tests/phpunit/includes/user/UserGroupManagerTest.php index b5c502ed61a0..2cc642fbd18b 100644 --- a/tests/phpunit/includes/user/UserGroupManagerTest.php +++ b/tests/phpunit/includes/user/UserGroupManagerTest.php @@ -181,7 +181,7 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase { $this->assertTrue( $manager->addUserToGroup( $user, self::GROUP ), - 'Sanity: added user to group' + 'added user to group' ); $this->assertArrayEquals( [ '*', 'user', 'autoconfirmed' ], @@ -494,7 +494,7 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase { $expiryInPast = wfTimestamp( TS_MW, time() - 100500 ); $this->assertTrue( $manager->addUserToGroup( $user, 'expired', $expiryInPast ), - 'Sanity: can add expired group' + 'can add expired group' ); $manager->purgeExpired(); $this->assertNotContains( 'expired', $manager->getUserGroups( $user ) ); @@ -989,9 +989,9 @@ class UserGroupManagerTest extends MediaWikiIntegrationTestCase { $manager->removeUserFromGroup( $user, $formerGroup ); } $this->assertArrayEquals( $userGroups, $manager->getUserGroups( $user ), - false, 'Sanity: user groups are correct ' ); + false, 'user groups are correct ' ); $this->assertArrayEquals( $formerGroups, $manager->getUserFormerGroups( $user ), - false, 'Sanity: user former groups are correct ' ); + false, 'user former groups are correct ' ); $this->assertArrayEquals( $expected, $manager->getUserAutopromoteOnceGroups( $user, 'EVENT' ) diff --git a/tests/phpunit/includes/user/UserTest.php b/tests/phpunit/includes/user/UserTest.php index 11894fa9cc07..b59869c6e032 100644 --- a/tests/phpunit/includes/user/UserTest.php +++ b/tests/phpunit/includes/user/UserTest.php @@ -348,7 +348,6 @@ class UserTest extends MediaWikiIntegrationTestCase { ], ] ); - // Sanity $this->assertTrue( $this->user->isValidPassword( 'Password1234' ) ); // Minimum length @@ -784,7 +783,6 @@ class UserTest extends MediaWikiIntegrationTestCase { 'User::saveSettings updates actor table for name change' ); - // For sanity $ip = '192.168.12.34'; $this->db->delete( 'actor', [ 'actor_name' => $ip ], __METHOD__ ); diff --git a/tests/phpunit/integration/includes/Rest/Handler/PageHTMLHandlerTest.php b/tests/phpunit/integration/includes/Rest/Handler/PageHTMLHandlerTest.php index 23c0fd5dc0e0..b42acbe8c733 100644 --- a/tests/phpunit/integration/includes/Rest/Handler/PageHTMLHandlerTest.php +++ b/tests/phpunit/integration/includes/Rest/Handler/PageHTMLHandlerTest.php @@ -113,7 +113,7 @@ class PageHTMLHandlerTest extends MediaWikiIntegrationTestCase { $page = $this->getExistingTestPage( 'HtmlEndpointTestPage/with/slashes' ); $this->assertTrue( $this->editPage( $page, self::WIKITEXT )->isGood(), - 'Sanity: edited a page' + 'Edited a page' ); $request = new RequestData( @@ -136,7 +136,7 @@ class PageHTMLHandlerTest extends MediaWikiIntegrationTestCase { $page = $this->getExistingTestPage( 'HtmlEndpointTestPage/with/slashes' ); $this->assertTrue( $this->editPage( $page, self::WIKITEXT )->isGood(), - 'Sanity: edited a page' + 'Edited a page' ); $request = new RequestData( @@ -230,7 +230,7 @@ class PageHTMLHandlerTest extends MediaWikiIntegrationTestCase { MWTimestamp::setFakeTime( $time ); $this->assertTrue( $page->getTitle()->invalidateCache( MWTimestamp::convert( TS_MW, $time ) ), - 'Sanity: can invalidate cache' + 'Can invalidate cache' ); DeferredUpdates::doUpdates(); diff --git a/tests/phpunit/integration/includes/Rest/Handler/ParsoidHTMLHelperTest.php b/tests/phpunit/integration/includes/Rest/Handler/ParsoidHTMLHelperTest.php index 821925561618..199fd7aadc79 100644 --- a/tests/phpunit/integration/includes/Rest/Handler/ParsoidHTMLHelperTest.php +++ b/tests/phpunit/integration/includes/Rest/Handler/ParsoidHTMLHelperTest.php @@ -213,7 +213,7 @@ class ParsoidHTMLHelperTest extends MediaWikiIntegrationTestCase { MWTimestamp::setFakeTime( $now ); $this->assertTrue( $page->getTitle()->invalidateCache( MWTimestamp::convert( TS_MW, $now ) ), - 'Sanity: can invalidate cache' + 'Can invalidate cache' ); DeferredUpdates::doUpdates(); $page->clear(); diff --git a/tests/phpunit/integration/includes/Rest/Handler/RevisionHTMLHandlerTest.php b/tests/phpunit/integration/includes/Rest/Handler/RevisionHTMLHandlerTest.php index c02b104f6d4f..4d7c9e411836 100644 --- a/tests/phpunit/integration/includes/Rest/Handler/RevisionHTMLHandlerTest.php +++ b/tests/phpunit/integration/includes/Rest/Handler/RevisionHTMLHandlerTest.php @@ -138,7 +138,7 @@ class RevisionHTMLHandlerTest extends MediaWikiIntegrationTestCase { [ $page, $revisions ] = $this->getExistingPageWithRevisions( __METHOD__ ); $this->assertTrue( $this->editPage( $page, self::WIKITEXT )->isGood(), - 'Sanity: edited a page' + 'Edited a page' ); $request = new RequestData( @@ -161,7 +161,7 @@ class RevisionHTMLHandlerTest extends MediaWikiIntegrationTestCase { [ $page, $revisions ] = $this->getExistingPageWithRevisions( __METHOD__ ); $this->assertTrue( $this->editPage( $page, self::WIKITEXT )->isGood(), - 'Sanity: edited a page' + 'Edited a page' ); $request = new RequestData( @@ -252,7 +252,7 @@ class RevisionHTMLHandlerTest extends MediaWikiIntegrationTestCase { MWTimestamp::setFakeTime( $time + 10000 ); $this->assertTrue( $page->getTitle()->invalidateCache( MWTimestamp::convert( TS_MW, $time ) ), - 'Sanity: can invalidate cache' + 'Can invalidate cache' ); DeferredUpdates::doUpdates(); diff --git a/tests/phpunit/integration/includes/StubGlobalUserTest.php b/tests/phpunit/integration/includes/StubGlobalUserTest.php index c467d8461036..63aead2fd6f8 100644 --- a/tests/phpunit/integration/includes/StubGlobalUserTest.php +++ b/tests/phpunit/integration/includes/StubGlobalUserTest.php @@ -81,7 +81,7 @@ class StubGlobalUserTest extends MediaWikiIntegrationTestCase { $this->assertInstanceOf( StubGlobalUser::class, $wgUser, - 'Sanity check: $wgUser should be a StubGlobalUser at the start of the test' + 'Check: $wgUser should be a StubGlobalUser at the start of the test' ); $this->assertSame( 12345, @@ -103,7 +103,7 @@ class StubGlobalUserTest extends MediaWikiIntegrationTestCase { $this->assertInstanceOf( StubGlobalUser::class, $wgUser, - 'Sanity check: $wgUser should be a StubGlobalUser at the start of the test' + 'Check: $wgUser should be a StubGlobalUser at the start of the test' ); $this->assertSame( 12345, @@ -129,7 +129,7 @@ class StubGlobalUserTest extends MediaWikiIntegrationTestCase { $this->assertInstanceOf( StubGlobalUser::class, $wgUser, - 'Sanity check: $wgUser should be a StubGlobalUser at the start of the test' + 'Check: $wgUser should be a StubGlobalUser at the start of the test' ); $wgUser->mId = 2000; $this->assertInstanceOf( diff --git a/tests/phpunit/integration/includes/page/RollbackPageTest.php b/tests/phpunit/integration/includes/page/RollbackPageTest.php index 4c3d6118ce0d..154102f589c5 100644 --- a/tests/phpunit/integration/includes/page/RollbackPageTest.php +++ b/tests/phpunit/integration/includes/page/RollbackPageTest.php @@ -124,15 +124,15 @@ class RollbackPageTest extends MediaWikiIntegrationTestCase { // Make some edits $text = "one"; $status1 = $this->editPage( $page, $text, "section one", NS_MAIN, $admin ); - $this->assertTrue( $status1->isGood(), 'Sanity: edit 1 success' ); + $this->assertTrue( $status1->isGood(), 'edit 1 success' ); $text .= "\n\ntwo"; $status2 = $this->editPage( $page, $text, "adding section two", NS_MAIN, $user1 ); - $this->assertTrue( $status2->isGood(), 'Sanity: edit 2 success' ); + $this->assertTrue( $status2->isGood(), 'edit 2 success' ); $text .= "\n\nthree"; $status3 = $this->editPage( $page, $text, "adding section three", NS_MAIN, $user2 ); - $this->assertTrue( $status3->isGood(), 'Sanity: edit 3 success' ); + $this->assertTrue( $status3->isGood(), 'edit 3 success' ); /** @var RevisionRecord $rev1 */ /** @var RevisionRecord $rev2 */ @@ -191,13 +191,13 @@ class RollbackPageTest extends MediaWikiIntegrationTestCase { $text = "one"; $status1 = $this->editPage( $page, $text, "section one", NS_MAIN, $admin ); - $this->assertTrue( $status1->isGood(), 'Sanity: edit 1 success' ); + $this->assertTrue( $status1->isGood(), 'edit 1 success' ); $rev1 = $page->getRevisionRecord(); $user1 = $this->getTestUser( [ 'sysop' ] )->getUser(); $text .= "\n\ntwo"; $status1 = $this->editPage( $page, $text, "adding section two", NS_MAIN, $user1 ); - $this->assertTrue( $status1->isGood(), 'Sanity: edit 2 success' ); + $this->assertTrue( $status1->isGood(), 'edit 2 success' ); $rollbackResult = $this->getServiceContainer() ->getRollbackPageFactory() @@ -243,12 +243,12 @@ class RollbackPageTest extends MediaWikiIntegrationTestCase { $result = []; $text = "one"; $status = $this->editPage( $page, $text, "section one", NS_MAIN, $user1 ); - $this->assertTrue( $status->isGood(), 'Sanity: edit 1 success' ); + $this->assertTrue( $status->isGood(), 'edit 1 success' ); $result['revision-one'] = $status->getValue()['revision-record']; $text .= "\n\ntwo"; $status = $this->editPage( $page, $text, "adding section two", NS_MAIN, $user2 ); - $this->assertTrue( $status->isGood(), 'Sanity: edit 2 success' ); + $this->assertTrue( $status->isGood(), 'edit 2 success' ); $result['revision-two'] = $status->getValue()['revision-record']; return $result; } @@ -348,11 +348,11 @@ class RollbackPageTest extends MediaWikiIntegrationTestCase { $status1 = $this->editPage( $page, new JsonContent( '{}' ), "it's json", NS_MAIN, $admin ); - $this->assertTrue( $status1->isGood(), 'Sanity: edit 1 success' ); + $this->assertTrue( $status1->isGood(), 'edit 1 success' ); $status1 = $this->editPage( $page, new WikitextContent( 'bla' ), "no, it's wikitext", NS_MAIN, $user1 ); - $this->assertTrue( $status1->isGood(), 'Sanity: edit 2 success' ); + $this->assertTrue( $status1->isGood(), 'edit 2 success' ); $rollbackResult = $this->getServiceContainer() ->getRollbackPageFactory() diff --git a/tests/phpunit/integration/includes/user/ActorStoreTest.php b/tests/phpunit/integration/includes/user/ActorStoreTest.php index d8817a11fb86..555597bef4e9 100644 --- a/tests/phpunit/integration/includes/user/ActorStoreTest.php +++ b/tests/phpunit/integration/includes/user/ActorStoreTest.php @@ -768,7 +768,7 @@ class ActorStoreTest extends ActorStoreTestBase { $store = $this->getStore(); $originalActor = new UserIdentityValue( 0, '129.0.0.1' ); $actorId = $store->createNewActor( $originalActor, $this->db ); - $this->assertTrue( $actorId > 0, 'Sanity: acquired new actor ID' ); + $this->assertTrue( $actorId > 0, 'Acquired new actor ID' ); $updatedActor = new UserIdentityValue( 56789, '129.0.0.1' ); $this->assertSame( $actorId, $store->acquireSystemActorId( $updatedActor, $this->db ) ); @@ -787,7 +787,7 @@ class ActorStoreTest extends ActorStoreTestBase { $store = $this->getStore(); $originalActor = new UserIdentityValue( 0, 'RESERVED' ); $actorId = $store->createNewActor( $originalActor, $this->db ); - $this->assertTrue( $actorId > 0, 'Sanity: acquired new actor ID' ); + $this->assertTrue( $actorId > 0, 'Acquired new actor ID' ); $updatedActor = new UserIdentityValue( 80, 'RESERVED' ); $this->assertSame( $actorId, $store->acquireSystemActorId( $updatedActor, $this->db ) ); diff --git a/tests/phpunit/integration/includes/user/ActorStoreTestBase.php b/tests/phpunit/integration/includes/user/ActorStoreTestBase.php index 599f46b75298..51780fa0d9e3 100644 --- a/tests/phpunit/integration/includes/user/ActorStoreTestBase.php +++ b/tests/phpunit/integration/includes/user/ActorStoreTestBase.php @@ -33,7 +33,7 @@ abstract class ActorStoreTestBase extends MediaWikiIntegrationTestCase { $row, __METHOD__, [ 'IGNORE' ] - ), "Sanity: must create {$description} actor" ); + ), "Must create {$description} actor" ); } } diff --git a/tests/phpunit/integration/includes/user/UserFactoryTest.php b/tests/phpunit/integration/includes/user/UserFactoryTest.php index 9c5d1e2f8b21..1d62a45ef1ea 100644 --- a/tests/phpunit/integration/includes/user/UserFactoryTest.php +++ b/tests/phpunit/integration/includes/user/UserFactoryTest.php @@ -81,7 +81,7 @@ class UserFactoryTest extends MediaWikiIntegrationTestCase { $this->assertGreaterThan( 0, $actorId, - 'Sanity check: valid actor id for a user' + 'Valid actor id for a user' ); $user2 = $factory->newFromActorId( $actorId ); @@ -117,13 +117,13 @@ class UserFactoryTest extends MediaWikiIntegrationTestCase { $this->assertGreaterThan( 0, $id, - 'Sanity check: valid user' + 'Valid user' ); $actorId = $user1->getActorId(); $this->assertGreaterThan( 0, $actorId, - 'Sanity check: valid actor id for a user' + 'Valid actor id for a user' ); $user2 = $factory->newFromAnyId( $id, null, null ); diff --git a/tests/phpunit/maintenance/backupTextPassTest.php b/tests/phpunit/maintenance/backupTextPassTest.php index 3216c37e9249..71befe650e59 100644 --- a/tests/phpunit/maintenance/backupTextPassTest.php +++ b/tests/phpunit/maintenance/backupTextPassTest.php @@ -86,7 +86,7 @@ class TextPassDumperDatabaseTest extends DumpTestCase { $rev = $revisions[$revid]; $slot = $rev->getSlot( $role ); - // NOTE: TextPassDumper does a sanity check on the string length, + // NOTE: TextPassDumper does a check on the string length, // so we have to pad to match the original length. The hash is not checked. return str_pad( "Prefetch: ({$pageid}/{$revid}/$role)", $slot->getSize(), '*' ); }; diff --git a/tests/phpunit/structure/ApiStructureTest.php b/tests/phpunit/structure/ApiStructureTest.php index b9e9c78e70ec..b09a09ec0cfa 100644 --- a/tests/phpunit/structure/ApiStructureTest.php +++ b/tests/phpunit/structure/ApiStructureTest.php @@ -121,7 +121,7 @@ class ApiStructureTest extends MediaWikiIntegrationTestCase { $dataName = $this->dataName(); $this->assertNotSame( '', $name, "$dataName: Name cannot be empty" ); - $this->assertArrayHasKey( $name, $params, "$dataName: Sanity check" ); + $this->assertArrayHasKey( $name, $params, "$dataName: Existence check" ); $ret = $main->getParamValidator()->checkSettings( $main->getModuleFromPath( $path ), $params, $name, [] diff --git a/tests/phpunit/structure/ResourcesTest.php b/tests/phpunit/structure/ResourcesTest.php index ec9019692316..cc0abf812284 100644 --- a/tests/phpunit/structure/ResourcesTest.php +++ b/tests/phpunit/structure/ResourcesTest.php @@ -5,7 +5,7 @@ use Wikimedia\Minify\CSSMin; use Wikimedia\TestingAccessWrapper; /** - * Sanity checks for making sure registered resources are sane. + * Checks for making sure registered resources are sensible. * * @author Antoine Musso * @author Niklas Laxström diff --git a/tests/phpunit/tests/MediaWikiIntegrationTestCaseTest.php b/tests/phpunit/tests/MediaWikiIntegrationTestCaseTest.php index 54c630d4d9b9..c21ee9a5cab2 100644 --- a/tests/phpunit/tests/MediaWikiIntegrationTestCaseTest.php +++ b/tests/phpunit/tests/MediaWikiIntegrationTestCaseTest.php @@ -223,7 +223,6 @@ class MediaWikiIntegrationTestCaseTest extends MediaWikiIntegrationTestCase { $lb = $lbFactory->newMainLB(); $db = $lb->getConnection( DB_REPLICA ); - // sanity $this->assertNotSame( $this->db, $db ); // Make sure the DB connection has the fake table clones and the fake table prefix @@ -253,7 +252,6 @@ class MediaWikiIntegrationTestCaseTest extends MediaWikiIntegrationTestCase { $n++; }, true ); - // sanity check $this->assertSame( $myReadOnlyMode, $services->getService( 'ReadOnlyMode' ) ); // define a custom service @@ -265,7 +263,6 @@ class MediaWikiIntegrationTestCaseTest extends MediaWikiIntegrationTestCase { } ); - // sanity check $lang = $services->getMainConfig()->get( 'LanguageCode' ); $dummy = $services->getService( '_TEST_ResetService_Dummy' ); $this->assertSame( $lang, $dummy->lang ); diff --git a/tests/phpunit/unit/includes/HookContainer/HookContainerTest.php b/tests/phpunit/unit/includes/HookContainer/HookContainerTest.php index 2e1994cac88f..cc3a601e3f60 100644 --- a/tests/phpunit/unit/includes/HookContainer/HookContainerTest.php +++ b/tests/phpunit/unit/includes/HookContainer/HookContainerTest.php @@ -474,7 +474,7 @@ namespace MediaWiki\HookContainer { $count++; } ); - // Sanity check: all three handlers should be called initially. + // Check: all three handlers should be called initially. $count = 0; $hookContainer->run( 'Increment', [ &$count ] ); $this->assertSame( 3, $count ); @@ -515,7 +515,7 @@ namespace MediaWiki\HookContainer { $count++; } ); - // Sanity check: both handlers should be called initially. + // Check: both handlers should be called initially. $count = 0; $hookContainer->run( 'Increment', [ &$count ] ); $this->assertSame( 3, $count ); diff --git a/tests/phpunit/unit/includes/libs/ParamValidator/ParamValidatorTest.php b/tests/phpunit/unit/includes/libs/ParamValidator/ParamValidatorTest.php index 58dbee1fa408..8178b2365cd1 100644 --- a/tests/phpunit/unit/includes/libs/ParamValidator/ParamValidatorTest.php +++ b/tests/phpunit/unit/includes/libs/ParamValidator/ParamValidatorTest.php @@ -82,7 +82,7 @@ class ParamValidatorTest extends \PHPUnit\Framework\TestCase { ->setConstructorArgs( [ $callbacks ] ); $def1 = $mb->getMockForAbstractClass(); $def2 = $mb->getMockForAbstractClass(); - $this->assertNotSame( $def1, $def2, 'sanity check' ); + $this->assertNotSame( $def1, $def2, 'consistency check' ); $factory = $this->getMockBuilder( ObjectFactory::class ) ->setConstructorArgs( [ $this->getMockForAbstractClass( ContainerInterface::class ) ] ) diff --git a/tests/phpunit/unit/includes/libs/ParamValidator/Util/UploadedFileStreamTest.php b/tests/phpunit/unit/includes/libs/ParamValidator/Util/UploadedFileStreamTest.php index c851d034c54b..5b7efd0e830f 100644 --- a/tests/phpunit/unit/includes/libs/ParamValidator/Util/UploadedFileStreamTest.php +++ b/tests/phpunit/unit/includes/libs/ParamValidator/Util/UploadedFileStreamTest.php @@ -18,7 +18,7 @@ class UploadedFileStreamTest extends UploadedFileTestBase { $filename = $this->makeTemp( __FUNCTION__ ); unlink( $filename ); - $this->assertFileNotExists( $filename, 'sanity check' ); + $this->assertFileNotExists( $filename, 'Non existence check' ); $this->expectException( RuntimeException::class ); $this->expectExceptionMessage( "Failed to open file:" ); $stream = new UploadedFileStream( $filename ); @@ -41,7 +41,7 @@ class UploadedFileStreamTest extends UploadedFileTestBase { $filename = $this->makeTemp( __FUNCTION__ ); $stream = new UploadedFileStream( $filename ); $fp = TestingAccessWrapper::newFromObject( $stream )->fp; - $this->assertSame( 'f', fread( $fp, 1 ), 'sanity check' ); + $this->assertSame( 'f', fread( $fp, 1 ), 'read check' ); unset( $stream ); try { // PHP 7 raises warnings @@ -131,7 +131,7 @@ class UploadedFileStreamTest extends UploadedFileTestBase { // Cached file_put_contents( $filename, 'baz' ); clearstatcache(); - $this->assertSame( 3, stat( $filename )['size'], 'sanity check' ); + $this->assertSame( 3, stat( $filename )['size'], 'size check' ); $this->assertSame( 9, $stream->getSize() ); // No error if closed diff --git a/tests/phpunit/unit/includes/libs/ParamValidator/Util/UploadedFileTest.php b/tests/phpunit/unit/includes/libs/ParamValidator/Util/UploadedFileTest.php index 80a74e7e74cd..bd3a9071e794 100644 --- a/tests/phpunit/unit/includes/libs/ParamValidator/Util/UploadedFileTest.php +++ b/tests/phpunit/unit/includes/libs/ParamValidator/Util/UploadedFileTest.php @@ -85,15 +85,15 @@ class UploadedFileTest extends UploadedFileTestBase { public function testMoveTo() { // Successful move $filename = $this->makeTemp( __FUNCTION__ ); - $this->assertFileExists( $filename, 'sanity check' ); - $this->assertFileNotExists( "$filename.xxx", 'sanity check' ); + $this->assertFileExists( $filename, 'existence check' ); + $this->assertFileNotExists( "$filename.xxx", 'Non existence check' ); $file = new UploadedFile( [ 'error' => UPLOAD_ERR_OK, 'tmp_name' => $filename ], false ); $file->moveTo( $filename . '.xxx' ); $this->assertFileNotExists( $filename ); $this->assertFileExists( "$filename.xxx" ); // Fails on a second move attempt - $this->assertFileNotExists( "$filename.yyy", 'sanity check' ); + $this->assertFileNotExists( "$filename.yyy", 'Non existence check' ); try { $file->moveTo( $filename . '.yyy' ); $this->fail( 'Expected exception not thrown' ); @@ -108,8 +108,8 @@ class UploadedFileTest extends UploadedFileTestBase { // Fails if the file is missing $file = new UploadedFile( [ 'error' => UPLOAD_ERR_OK, 'tmp_name' => "$filename.aaa" ], false ); - $this->assertFileNotExists( "$filename.aaa", 'sanity check' ); - $this->assertFileNotExists( "$filename.bbb", 'sanity check' ); + $this->assertFileNotExists( "$filename.aaa", 'Non existence check' ); + $this->assertFileNotExists( "$filename.bbb", 'Non existence check' ); try { $file->moveTo( $filename . '.bbb' ); $this->fail( 'Expected exception not thrown' ); @@ -123,8 +123,8 @@ class UploadedFileTest extends UploadedFileTestBase { // Fails for non-upload file (when not flagged to ignore that) $filename = $this->makeTemp( __FUNCTION__ ); - $this->assertFileExists( $filename, 'sanity check' ); - $this->assertFileNotExists( "$filename.xxx", 'sanity check' ); + $this->assertFileExists( $filename, 'existence check' ); + $this->assertFileNotExists( "$filename.xxx", 'Non existence check' ); $file = new UploadedFile( [ 'error' => UPLOAD_ERR_OK, 'tmp_name' => $filename ] ); try { $file->moveTo( $filename . '.xxx' ); @@ -139,8 +139,8 @@ class UploadedFileTest extends UploadedFileTestBase { // Fails for error uploads $filename = $this->makeTemp( __FUNCTION__ ); - $this->assertFileExists( $filename, 'sanity check' ); - $this->assertFileNotExists( "$filename.xxx", 'sanity check' ); + $this->assertFileExists( $filename, 'existence check' ); + $this->assertFileNotExists( "$filename.xxx", 'Non existence check' ); foreach ( [ UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, @@ -166,7 +166,7 @@ class UploadedFileTest extends UploadedFileTestBase { // Move failure triggers exception $filename = $this->makeTemp( __FUNCTION__, 'file1' ); $filename2 = $this->makeTemp( __FUNCTION__, 'file2' ); - $this->assertFileExists( $filename, 'sanity check' ); + $this->assertFileExists( $filename, 'existence check' ); $file = new UploadedFile( [ 'error' => UPLOAD_ERR_OK, 'tmp_name' => $filename ], false ); try { $file->moveTo( $filename2 . DIRECTORY_SEPARATOR . 'foobar' ); diff --git a/tests/phpunit/unit/includes/libs/mime/MimeAnalyzerTest.php b/tests/phpunit/unit/includes/libs/mime/MimeAnalyzerTest.php index b55b740088b8..0287a87684f3 100644 --- a/tests/phpunit/unit/includes/libs/mime/MimeAnalyzerTest.php +++ b/tests/phpunit/unit/includes/libs/mime/MimeAnalyzerTest.php @@ -167,7 +167,7 @@ class MimeAnalyzerTest extends PHPUnit\Framework\TestCase { [ 'A ZIP file similar to the above, but without either of those two ' . 'problems. Not a valid ZIP file, but it passes MimeAnalyzer\'s ' . - 'definition of a ZIP file. This is mostly a sanity check of the ' . + 'definition of a ZIP file. This is mostly a double check of the ' . 'above two tests.', 'zip-kind-of-valid.png', 'application/zip', diff --git a/tests/phpunit/unit/includes/password/BcryptPasswordTest.php b/tests/phpunit/unit/includes/password/BcryptPasswordTest.php index 952f54175038..ad9116b41c50 100644 --- a/tests/phpunit/unit/includes/password/BcryptPasswordTest.php +++ b/tests/phpunit/unit/includes/password/BcryptPasswordTest.php @@ -35,7 +35,7 @@ class BcryptPasswordTest extends PasswordTestCase { [ true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$R9xrDjiycxMbQE2bp.vgqlYpW5wx2yy', "\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55" ], [ true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$9tQZzcJfm3uj2NvJ/n5xkhpqLrMpWCe', "\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff" ], [ true, ':bcrypt:5$CCCCCCCCCCCCCCCCCCCCC.$7uG0VCzI2bS7j6ymqJi9CdcdxiRTWNy', "" ], - // One or two false sanity tests + // False positive tests [ false, ':bcrypt:5$CCCCCCCCCCCCCCCCCCCCC.$E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW', "UXU" ], [ false, ':bcrypt:5$CCCCCCCCCCCCCCCCCCCCC.$E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW', "" ], ]; |