Merge "Remove `inline-block` from message boxes"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 20 Sep 2019 23:18:09 +0000 (23:18 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 20 Sep 2019 23:18:09 +0000 (23:18 +0000)
114 files changed:
.phan/config.php
includes/EditPage.php
includes/MovePage.php
includes/Revision/RevisionStore.php
includes/api/ApiBase.php
includes/api/ApiErrorFormatter.php
includes/api/ApiQueryLogEvents.php
includes/api/ApiTag.php
includes/api/ApiUpload.php
includes/api/i18n/lt.json
includes/block/BlockManager.php
includes/changes/ChangesList.php
includes/changes/OldChangesList.php
includes/filerepo/file/ArchivedFile.php
includes/htmlform/fields/HTMLTitleTextField.php
includes/htmlform/fields/HTMLUserTextField.php
includes/http/HttpRequestFactory.php
includes/import/WikiRevision.php
includes/libs/filebackend/SwiftFileBackend.php
includes/mail/UserMailer.php
includes/page/MovePageFactory.php
includes/parser/PPDPart_Hash.php
includes/site/SiteImporter.php
includes/skins/BaseTemplate.php
includes/specials/SpecialPagesWithProp.php
languages/i18n/cs.json
languages/i18n/de.json
languages/i18n/diq.json
languages/i18n/exif/tt-cyrl.json
languages/i18n/hu.json
languages/i18n/it.json
languages/i18n/lt.json
languages/i18n/pt-br.json
languages/i18n/roa-tara.json
languages/i18n/ru.json
languages/i18n/uk.json
languages/i18n/zh-hans.json
languages/i18n/zh-hant.json
maintenance/addChangeTag.php
maintenance/changePassword.php
maintenance/cleanupCaps.php
maintenance/copyFileBackend.php
maintenance/createAndPromote.php
maintenance/edit.php
maintenance/importDump.php
maintenance/importImages.php
maintenance/install.php
maintenance/moveBatch.php
maintenance/refreshFileHeaders.php
resources/src/mediawiki.page.gallery.slideshow.js
resources/src/mediawiki.page.image.pagination.js
tests/phpunit/MediaWikiCoversValidator.php
tests/phpunit/MediaWikiIntegrationTestCase.php
tests/phpunit/includes/EditPageTest.php
tests/phpunit/includes/FauxRequestTest.php
tests/phpunit/includes/HtmlTest.php
tests/phpunit/includes/LinkerTest.php
tests/phpunit/includes/MediaWikiServicesTest.php
tests/phpunit/includes/OutputPageTest.php
tests/phpunit/includes/Revision/McrRevisionStoreDbTest.php
tests/phpunit/includes/Revision/RevisionStoreDbTestBase.php
tests/phpunit/includes/SiteStatsTest.php
tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php
tests/phpunit/includes/TitleMethodsTest.php
tests/phpunit/includes/XmlTest.php
tests/phpunit/includes/api/ApiPageSetTest.php
tests/phpunit/includes/api/ApiQueryWatchlistIntegrationTest.php
tests/phpunit/includes/api/ApiQueryWatchlistRawIntegrationTest.php
tests/phpunit/includes/api/ApiWatchTest.php
tests/phpunit/includes/auth/AuthManagerTest.php
tests/phpunit/includes/block/BlockRestrictionStoreTest.php
tests/phpunit/includes/block/DatabaseBlockTest.php
tests/phpunit/includes/cache/MessageCacheTest.php
tests/phpunit/includes/changes/CategoryMembershipChangeTest.php
tests/phpunit/includes/changes/EnhancedChangesListTest.php
tests/phpunit/includes/changes/RCCacheEntryFactoryTest.php
tests/phpunit/includes/content/ContentHandlerTest.php
tests/phpunit/includes/content/UnknownContentHandlerTest.php
tests/phpunit/includes/content/UnknownContentTest.php
tests/phpunit/includes/content/WikitextContentHandlerTest.php
tests/phpunit/includes/context/RequestContextTest.php
tests/phpunit/includes/db/LBFactoryTest.php
tests/phpunit/includes/deferred/SiteStatsUpdateTest.php
tests/phpunit/includes/filebackend/FileBackendTest.php
tests/phpunit/includes/filerepo/file/LocalFileTest.php
tests/phpunit/includes/http/GuzzleHttpRequestTest.php
tests/phpunit/includes/http/HttpTest.php
tests/phpunit/includes/jobqueue/JobQueueTest.php
tests/phpunit/includes/jobqueue/jobs/ClearUserWatchlistJobTest.php
tests/phpunit/includes/libs/ProcessCacheLRUTest.php
tests/phpunit/includes/libs/TimingTest.php
tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php
tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php
tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php
tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php
tests/phpunit/includes/linker/LinkRendererTest.php
tests/phpunit/includes/media/JpegPixelFormatTest.php
tests/phpunit/includes/media/PNGMetadataExtractorTest.php
tests/phpunit/includes/page/WikiPageDbTestBase.php
tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
tests/phpunit/includes/search/SearchNearMatchResultSetTest.php
tests/phpunit/includes/shell/ShellTest.php
tests/phpunit/includes/site/CachingSiteStoreTest.php
tests/phpunit/includes/site/DBSiteStoreTest.php
tests/phpunit/includes/site/SiteTest.php
tests/phpunit/includes/user/UserTest.php
tests/phpunit/includes/watcheditem/WatchedItemStoreUnitTest.php
tests/phpunit/integration/includes/db/DatabaseSqliteTest.php
tests/phpunit/languages/LanguageTest.php
tests/phpunit/maintenance/DumpTestCase.php
tests/phpunit/unit/includes/diff/DiffOpTest.php
tests/phpunit/unit/includes/password/PasswordFactoryTest.php
tests/phpunit/unit/includes/search/SearchSuggestionSetTest.php
tests/selenium/wdio.conf.js

index 56a8ccb..0fdefe0 100644 (file)
@@ -101,9 +101,6 @@ $cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [
        //after dropping HHVM
        // approximate error count: 110
        "PhanParamTooMany", // False positives with variargs. Unsuppress after dropping HHVM
-
-       // approximate error count: 45
-       "PhanTypeMismatchArgument",
 ] );
 
 // This helps a lot in discovering bad code, but unfortunately it will always fail for
index 10eea89..9182300 100644 (file)
@@ -1156,7 +1156,7 @@ class EditPage {
                        $out->showErrorPage(
                                'modeleditnotsupported-title',
                                'modeleditnotsupported-text',
-                               $modelName
+                               [ $modelName ]
                        );
                        return false;
                }
index 634e7af..59baae7 100644 (file)
@@ -83,7 +83,7 @@ class MovePage {
         * @param ServiceOptions|null $options
         * @param ILoadBalancer|null $loadBalancer
         * @param NamespaceInfo|null $nsInfo
-        * @param WatchedItemStore|null $watchedItems
+        * @param WatchedItemStoreInterface|null $watchedItems
         * @param PermissionManager|null $permMgr
         */
        public function __construct(
index 735a212..3ecef76 100644 (file)
@@ -1623,10 +1623,18 @@ class RevisionStore
         * @param object[]|IResultWrapper $slotRows
         * @param int $queryFlags
         * @param Title $title
+        * @param array|null $slotContents a map from blobAddress to slot
+        *      content blob or Content object.
         *
         * @return SlotRecord[]
         */
-       private function constructSlotRecords( $revId, $slotRows, $queryFlags, Title $title ) {
+       private function constructSlotRecords(
+               $revId,
+               $slotRows,
+               $queryFlags,
+               Title $title,
+               $slotContents = null
+       ) {
                $slots = [];
 
                foreach ( $slotRows as $row ) {
@@ -1651,8 +1659,15 @@ class RevisionStore
                                        = $this->emulateContentId( intval( $row->rev_text_id ) );
                        }
 
-                       $contentCallback = function ( SlotRecord $slot ) use ( $queryFlags ) {
-                               return $this->loadSlotContent( $slot, null, null, null, $queryFlags );
+                       $contentCallback = function ( SlotRecord $slot ) use ( $slotContents, $queryFlags ) {
+                               $blob = null;
+                               if ( isset( $slotContents[$slot->getAddress()] ) ) {
+                                       $blob = $slotContents[$slot->getAddress()];
+                                       if ( $blob instanceof Content ) {
+                                               return $blob;
+                                       }
+                               }
+                               return $this->loadSlotContent( $slot, $blob, null, null, $queryFlags );
                        };
 
                        $slots[$row->role_name] = new SlotRecord( $row, $contentCallback );
@@ -1804,8 +1819,10 @@ class RevisionStore
 
        /**
         * @param object $row A database row generated from a query based on getQueryInfo()
-        * @param null|object[] $slotRows Database rows generated from a query based on
-        *        getSlotsQueryInfo with the 'content' flag set.
+        * @param null|object[]|RevisionSlots $slots
+        *      - Database rows generated from a query based on getSlotsQueryInfo
+        *        with the 'content' flag set. Or
+        *  - RevisionSlots instance
         * @param int $queryFlags
         * @param Title|null $title
         * @param bool $fromCache if true, the returned RevisionRecord will ensure that no stale
@@ -1816,11 +1833,10 @@ class RevisionStore
         * @see RevisionFactory::newRevisionFromRow
         *
         * MCR migration note: this replaces Revision::newFromRow
-        *
         */
        public function newRevisionFromRowAndSlots(
                $row,
-               $slotRows,
+               $slots,
                $queryFlags = 0,
                Title $title = null,
                $fromCache = false
@@ -1857,7 +1873,9 @@ class RevisionStore
                // Legacy because $row may have come from self::selectFields()
                $comment = $this->commentStore->getCommentLegacy( $db, 'rev_comment', $row, true );
 
-               $slots = $this->newRevisionSlots( $row->rev_id, $row, $slotRows, $queryFlags, $title );
+               if ( !( $slots instanceof RevisionSlots ) ) {
+                       $slots = $this->newRevisionSlots( $row->rev_id, $row, $slots, $queryFlags, $title );
+               }
 
                // If this is a cached row, instantiate a cache-aware revision class to avoid stale data.
                if ( $fromCache ) {
@@ -1887,7 +1905,7 @@ class RevisionStore
         *               loaded immediately. Supports falsy or truthy value as well
         *               as an explicit list of slot role names.
         *               'content'- whether the actual content of the slots should be
-        *               preloaded. TODO: no supported yet.
+        *               preloaded.
         * @param int $queryFlags
         * @param Title|null $title
         * @return StatusValue a status with a RevisionRecord[] of successfully fetched revisions
@@ -1957,24 +1975,40 @@ class RevisionStore
                        }, $options['slots'] );
                }
 
-               // TODO: Support optional fetching of the content
-               $queryInfo = self::getSlotsQueryInfo( [ 'content' ] );
+               // We need to set the `content` flag because newRevisionFromRowAndSlots requires content
+               // metadata to be loaded.
+               $slotQueryInfo = self::getSlotsQueryInfo( [ 'content' ] );
                $db = $this->getDBConnectionRefForQueryFlags( $queryFlags );
                $slotRows = $db->select(
-                       $queryInfo['tables'],
-                       $queryInfo['fields'],
+                       $slotQueryInfo['tables'],
+                       $slotQueryInfo['fields'],
                        $slotQueryConds,
                        __METHOD__,
                        [],
-                       $queryInfo['joins']
+                       $slotQueryInfo['joins']
                );
 
                $slotRowsByRevId = [];
                foreach ( $slotRows as $slotRow ) {
                        $slotRowsByRevId[$slotRow->slot_revision_id][] = $slotRow;
                }
+
+               $slotContents = null;
+               if ( $options['content'] ?? false ) {
+                       $blobAddresses = [];
+                       foreach ( $slotRows as $slotRow ) {
+                               $blobAddresses[] = $slotRow->content_address;
+                       }
+                       $slotContentFetchStatus = $this->blobStore
+                               ->getBlobBatch( $blobAddresses, $queryFlags );
+                       foreach ( $slotContentFetchStatus->getErrors() as $error ) {
+                               $result->warning( $error['message'], ...$error['params'] );
+                       }
+                       $slotContents = $slotContentFetchStatus->getValue();
+               }
+
                $result->setResult( true, array_map( function ( $row ) use
-                       ( $slotRowsByRevId, $queryFlags, $titlesByPageId, $result ) {
+                       ( $slotRowsByRevId, $queryFlags, $titlesByPageId, $slotContents, $result ) {
                                if ( !isset( $slotRowsByRevId[$row->rev_id] ) ) {
                                        $result->warning(
                                                'internalerror',
@@ -1985,7 +2019,15 @@ class RevisionStore
                                try {
                                        return $this->newRevisionFromRowAndSlots(
                                                $row,
-                                               $slotRowsByRevId[$row->rev_id],
+                                               new RevisionSlots(
+                                                       $this->constructSlotRecords(
+                                                               $row->rev_id,
+                                                               $slotRowsByRevId[$row->rev_id],
+                                                               $queryFlags,
+                                                               $titlesByPageId[$row->rev_page],
+                                                               $slotContents
+                                                       )
+                                               ),
                                                $queryFlags,
                                                $titlesByPageId[$row->rev_page]
                                        );
index 056d10c..7518008 100644 (file)
@@ -1585,6 +1585,7 @@ abstract class ApiBase extends ContextSource {
                                'integeroutofrange',
                                [ 'min' => $min, 'max' => $max, 'botMax' => $botMax ?: $max ]
                        );
+                       // @phan-suppress-next-line PhanTypeMismatchArgument
                        $this->warnOrDie( $msg, $enforceLimits );
                        $value = $min;
                }
@@ -1606,6 +1607,7 @@ abstract class ApiBase extends ContextSource {
                                                'integeroutofrange',
                                                [ 'min' => $min, 'max' => $max, 'botMax' => $botMax ?: $max ]
                                        );
+                                       // @phan-suppress-next-line PhanTypeMismatchArgument
                                        $this->warnOrDie( $msg, $enforceLimits );
                                        $value = $botMax;
                                }
@@ -1616,6 +1618,7 @@ abstract class ApiBase extends ContextSource {
                                        'integeroutofrange',
                                        [ 'min' => $min, 'max' => $max, 'botMax' => $botMax ?: $max ]
                                );
+                               // @phan-suppress-next-line PhanTypeMismatchArgument
                                $this->warnOrDie( $msg, $enforceLimits );
                                $value = $max;
                        }
@@ -2022,6 +2025,7 @@ abstract class ApiBase extends ContextSource {
         */
        public function dieWithException( $exception, array $options = [] ) {
                $this->dieWithError(
+                       // @phan-suppress-next-line PhanTypeMismatchArgument
                        $this->getErrorFormatter()->getMessageFromException( $exception, $options )
                );
        }
@@ -2464,6 +2468,7 @@ abstract class ApiBase extends ContextSource {
                                        if ( $m ) {
                                                $m = new ApiHelpParamValueMessage(
                                                        $value,
+                                                       // @phan-suppress-next-line PhanTypeMismatchArgument
                                                        [ $m->getKey(), 'api-help-param-no-description' ],
                                                        $m->getParams(),
                                                        isset( $deprecatedValues[$value] )
index 81ee9b9..9dfd370 100644 (file)
@@ -237,6 +237,7 @@ class ApiErrorFormatter {
         */
        public function formatException( $exception, array $options = [] ) {
                return $this->formatMessage(
+                       // @phan-suppress-next-line PhanTypeMismatchArgument
                        $this->getMessageFromException( $exception, $options ),
                        $options['format'] ?? null
                );
index 47a6f87..2c19c7d 100644 (file)
@@ -186,6 +186,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
 
                        // T71222: MariaDB's optimizer, at least 10.1.37 and .38, likes to choose a wildly bad plan for
                        // some reason for this code path. Tell it not to use the wrong index it wants to pick.
+                       // @phan-suppress-next-line PhanTypeMismatchArgument
                        $this->addOption( 'IGNORE INDEX', [ 'logging' => [ 'times' ] ] );
                }
 
index bb6c580..f2b52cd 100644 (file)
@@ -96,6 +96,7 @@ class ApiTag extends ApiBase {
                                $valid = RecentChange::newFromId( $id );
                                if ( $valid && $this->getPermissionManager()->isBlockedFrom( $user, $valid->getTitle() ) ) {
                                        $idResult['status'] = 'error';
+                                       // @phan-suppress-next-line PhanTypeMismatchArgument
                                        $idResult += $this->getErrorFormatter()->formatMessage( ApiMessage::create(
                                                'apierror-blocked',
                                                'blocked',
@@ -111,6 +112,7 @@ class ApiTag extends ApiBase {
                                        $this->getPermissionManager()->isBlockedFrom( $user, $valid->getPageAsLinkTarget() )
                                ) {
                                        $idResult['status'] = 'error';
+                                       // @phan-suppress-next-line PhanTypeMismatchArgument
                                        $idResult += $this->getErrorFormatter()->formatMessage( ApiMessage::create(
                                                        'apierror-blocked',
                                                        'blocked',
index 373ec11..4678e1f 100644 (file)
@@ -636,6 +636,7 @@ class ApiUpload extends ApiBase {
                                }
                                ApiResult::setIndexedTagName( $details, 'detail' );
                                $msg->setApiData( $msg->getApiData() + [ 'details' => $details ] );
+                               // @phan-suppress-next-line PhanTypeMismatchArgument
                                $this->dieWithError( $msg );
                                break;
 
index 907be26..51350a1 100644 (file)
@@ -3,7 +3,8 @@
                "authors": [
                        "Zygimantus",
                        "Eitvys200",
-                       "Hugo.arg"
+                       "Hugo.arg",
+                       "Homo"
                ]
        },
        "apihelp-main-param-action": "Kurį veiksmą atlikti.",
@@ -19,7 +20,7 @@
        "apihelp-createaccount-summary": "Kurti naują vartotojo paskyrą.",
        "apihelp-delete-summary": "Ištrinti puslapį.",
        "apihelp-delete-param-watch": "Pridėti puslapį prie dabartinio vartotojo stebimųjų sąrašo.",
-       "apihelp-delete-param-unwatch": "Pašalinti puslapį iš dabartinio vartotojo stebimųjų sąrašo.",
+       "apihelp-delete-param-unwatch": "Pašalinti puslapį iš dabartinio naudotojo stebimųjų sąrašo.",
        "apihelp-delete-example-simple": "Ištrinti <kbd>Main Page</kbd>.",
        "apihelp-delete-example-reason": "Ištrinti <kbd>Main Page</kbd> su priežastimi <kbd>Preparing for move</kbd>.",
        "apihelp-disabled-summary": "Šis modulis buvo išjungtas.",
@@ -36,7 +37,7 @@
        "apihelp-edit-param-createonly": "Neredaguoti puslapio jei jis jau egzistuoja.",
        "apihelp-edit-param-nocreate": "Parodyti klaidą, jei puslapis neegzistuoja.",
        "apihelp-edit-param-watch": "Pridėti puslapį į dabartinio vartotojo stebimųjų sąrašą.",
-       "apihelp-edit-param-unwatch": "Pašalinti puslapį iš dabartinio vartotojo stebimųjų sąrašo.",
+       "apihelp-edit-param-unwatch": "Pašalinti puslapį iš dabartinio naudotojo stebimųjų sąrašo.",
        "apihelp-edit-param-redirect": "Automatiškai išspręsti peradresavimus.",
        "apihelp-edit-param-contentmodel": "Naujam turiniui taikomas turinio modelis.",
        "apihelp-edit-example-edit": "Redaguoti puslapį.",
        "apihelp-move-param-movetalk": "Pervadinti aptarimo puslapį, jei jis egzistuoja.",
        "apihelp-move-param-noredirect": "Nekurti nukreipimo.",
        "apihelp-move-param-watch": "Pridėti puslapį ir nukreipimą į dabartinio vartotojo stebimųjų sąrašą.",
-       "apihelp-move-param-unwatch": "Pašalinti puslapį ir nukreipimą iš dabartinio vartotojo stebimųjų sąrašo.",
+       "apihelp-move-param-unwatch": "Pašalinti puslapį ir nukreipimą iš dabartinio naudotojo stebimųjų sąrašo.",
        "apihelp-move-param-ignorewarnings": "Ignuoruoti bet kokius įspėjimus.",
        "apihelp-move-example-move": "Perkelti <kbd>Badtitle</kbd> į <kbd>Goodtitle</kbd> nepaliekant nukreipimo.",
        "apihelp-opensearch-summary": "Ieškoti viki naudojant OpenSearch protokolą.",
        "apihelp-query+watchlist-paramvalue-type-new": "Puslapio sukūrimai.",
        "apihelp-query+watchlist-paramvalue-type-log": "Žurnalo įrašai.",
        "apihelp-resetpassword-param-user": "Iš naujo nustatomas vartotojas.",
-       "apihelp-resetpassword-param-email": "Iš naujo nustatomo vartotojo el. pašto adresas.",
+       "apihelp-resetpassword-param-email": "Iš naujo nustatomo naudotojo el. pašto adresas.",
        "apihelp-setpagelanguage-summary": "Keisti puslapio kalbą.",
        "apihelp-setpagelanguage-param-reason": "Keitimo priežastis.",
        "apihelp-stashedit-param-title": "Puslapio pavadinimas buvo redaguotas.",
index 4c2f27e..077bdca 100644 (file)
@@ -455,12 +455,14 @@ class BlockManager {
                                                // TODO: Improve on simply tracking the first trackable block (T225654)
                                                foreach ( $block->getOriginalBlocks() as $originalBlock ) {
                                                        if ( $this->shouldTrackBlockWithCookie( $originalBlock, $isAnon ) ) {
+                                                               '@phan-var DatabaseBlock $originalBlock';
                                                                $this->setBlockCookie( $originalBlock, $response );
                                                                return;
                                                        }
                                                }
                                        } else {
                                                if ( $this->shouldTrackBlockWithCookie( $block, $isAnon ) ) {
+                                                       '@phan-var DatabaseBlock $block';
                                                        $this->setBlockCookie( $block, $response );
                                                }
                                        }
index fbcbc35..34d73d6 100644 (file)
@@ -455,13 +455,21 @@ class ChangesList extends ContextSource {
         * @param string &$s HTML to update
         * @param Title $title
         * @param string $logtype
+        * @param bool $useParentheses (optional) Wrap log entry in parentheses where needed
         */
-       public function insertLog( &$s, $title, $logtype ) {
+       public function insertLog( &$s, $title, $logtype, $useParentheses = true ) {
                $page = new LogPage( $logtype );
                $logname = $page->getName()->setContext( $this->getContext() )->text();
-               $s .= Html::rawElement( 'span', [
-                       'class' => 'mw-changeslist-links'
-               ], $this->linkRenderer->makeKnownLink( $title, $logname ) );
+               $link = $this->linkRenderer->makeKnownLink( $title, $logname, [
+                       'class' => $useParentheses ? '' : 'mw-changeslist-links'
+               ] );
+               if ( $useParentheses ) {
+                       $s .= $this->msg( 'parentheses' )->rawParams(
+                               $link
+                       )->escaped();
+               } else {
+                       $s .= $link;
+               }
        }
 
        /**
@@ -625,7 +633,7 @@ class ChangesList extends ContextSource {
         */
        public function insertComment( $rc ) {
                if ( $this->isDeleted( $rc, RevisionRecord::DELETED_COMMENT ) ) {
-                       return ' <span class="history-deleted">' .
+                       return ' <span class="history-deleted comment">' .
                                $this->msg( 'rev-deleted-comment' )->escaped() . '</span>';
                } else {
                        return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle(),
index c15701b..8228bae 100644 (file)
@@ -87,7 +87,7 @@ class OldChangesList extends ChangesList {
 
                if ( $rc->mAttribs['rc_log_type'] ) {
                        $logtitle = SpecialPage::getTitleFor( 'Log', $rc->mAttribs['rc_log_type'] );
-                       $this->insertLog( $html, $logtitle, $rc->mAttribs['rc_log_type'] );
+                       $this->insertLog( $html, $logtitle, $rc->mAttribs['rc_log_type'], false );
                        $flags = $this->recentChangesFlags( [ 'unpatrolled' => $unpatrolled,
                                'bot' => $rc->mAttribs['rc_bot'] ], '' );
                        if ( $flags !== '' ) {
@@ -98,7 +98,7 @@ class OldChangesList extends ChangesList {
                        list( $name, $htmlubpage ) = MediaWikiServices::getInstance()->getSpecialPageFactory()->
                                resolveAlias( $rc->mAttribs['rc_title'] );
                        if ( $name == 'Log' ) {
-                               $this->insertLog( $html, $rc->getTitle(), $htmlubpage );
+                               $this->insertLog( $html, $rc->getTitle(), $htmlubpage, false );
                        }
                // Regular entries
                } else {
index b4fd176..a968831 100644 (file)
@@ -438,7 +438,9 @@ class ArchivedFile {
        function pageCount() {
                if ( !isset( $this->pageCount ) ) {
                        // @FIXME: callers expect File objects
+                       // @phan-suppress-next-line PhanTypeMismatchArgument
                        if ( $this->getHandler() && $this->handler->isMultiPage( $this ) ) {
+                               // @phan-suppress-next-line PhanTypeMismatchArgument
                                $this->pageCount = $this->handler->pageCount( $this );
                        } else {
                                $this->pageCount = false;
index 1eda33c..3df5b7e 100644 (file)
@@ -7,9 +7,6 @@ use MediaWiki\Widget\TitleInputWidget;
  * Automatically does validation that the title is valid,
  * as well as autocompletion if using the OOUI display format.
  *
- * Note: Forms using GET requests will need to make sure the title value is not
- * an empty string.
- *
  * Optional parameters:
  * 'namespace' - Namespace the page must be in
  * 'relative' - If true and 'namespace' given, strip/add the namespace from/to the title as needed
@@ -33,14 +30,6 @@ class HTMLTitleTextField extends HTMLTextField {
        }
 
        public function validate( $value, $alldata ) {
-               if ( $this->mParent->getMethod() === 'get' && $value === '' ) {
-                       // If the form is a GET form and has no value, assume it hasn't been
-                       // submitted yet, and skip validation
-                       // TODO This doesn't look right, we should be able to tell the difference
-                       // between "not submitted" (null) and "submitted but empty" (empty string).
-                       return parent::validate( $value, $alldata );
-               }
-
                // Default value (from getDefault()) is null, which breaks Title::newFromTextThrow() below
                if ( $value === null ) {
                        $value = '';
index 5b3bc25..0e4d842 100644 (file)
@@ -6,8 +6,6 @@ use MediaWiki\Widget\UserInputWidget;
  * Implements a text input field for user names.
  * Automatically auto-completes if using the OOUI display format.
  *
- * FIXME: Does not work for forms that support GET requests.
- *
  * Optional parameters:
  * 'exists' - Whether to validate that the user already exists
  * 'ipallowed' - Whether an IP adress is interpreted as "valid"
index 8433df6..510d26d 100644 (file)
@@ -59,7 +59,7 @@ class HttpRequestFactory {
         *    - originalRequest     Information about the original request (as a WebRequest object or
         *                          an associative array with 'ip' and 'userAgent').
         * @codingStandardsIgnoreStart
-        * @phan-param array{timeout?:int,connectTimeout?:int,postData?:array,proxy?:string,noProxy?:bool,sslVerifyHost?:bool,sslVerifyCert?:bool,caInfo?:string,maxRedirects?:int,followRedirects?:bool,userAgent?:string,logger?:\Psr\Logger\LoggerInterface,username?:string,password?:string,originalRequest?:WebRequest|array{ip:string,userAgent:string}} $options
+        * @phan-param array{timeout?:int,connectTimeout?:int,postData?:array,proxy?:string,noProxy?:bool,sslVerifyHost?:bool,sslVerifyCert?:bool,caInfo?:string,maxRedirects?:int,followRedirects?:bool,userAgent?:string,method?:string,logger?:\Psr\Log\LoggerInterface,username?:string,password?:string,originalRequest?:WebRequest|array{ip:string,userAgent:string}} $options
         * @codingStandardsIgnoreEnd
         * @param string $caller The method making this request, for profiling
         * @throws RuntimeException
index c29ba21..e0799c0 100644 (file)
@@ -185,9 +185,16 @@ class WikiRevision implements ImportableUploadRevision, ImportableOldRevision {
        /** @var bool */
        private $mNoUpdates = false;
 
-       /** @var Config $config */
+       /**
+        * @deprecated since 1.31, along with self::downloadSource()
+        * @var Config $config
+        */
        private $config;
 
+       /**
+        * @param Config $config Deprecated since 1.31, along with self::downloadSource(). Just pass an
+        *  empty HashConfig.
+        */
        public function __construct( Config $config ) {
                $this->config = $config;
        }
index 820634c..ce1e99f 100644 (file)
@@ -268,8 +268,8 @@ class SwiftFileBackend extends FileBackendStore {
                        'headers' => array_merge(
                                $mutableHeaders,
                                [
-                                       'content-length' => strlen( $params['content'] ),
                                        'etag' => md5( $params['content'] ),
+                                       'content-length' => strlen( $params['content'] ),
                                        'x-object-meta-sha1base36' =>
                                                Wikimedia\base_convert( sha1( $params['content'] ), 16, 36, 31 )
                                ]
@@ -311,18 +311,34 @@ class SwiftFileBackend extends FileBackendStore {
                        return $status;
                }
 
+               // Open a handle to the source file so that it can be streamed. The size and hash
+               // will be computed using the handle. In the off chance that the source file changes
+               // during this operation, the PUT will fail due to an ETag mismatch and be aborted.
                AtEase::suppressWarnings();
-               $sha1Base16 = sha1_file( $params['src'] );
+               $srcHandle = fopen( $params['src'], 'rb' );
                AtEase::restoreWarnings();
-               if ( $sha1Base16 === false ) { // source doesn't exist?
-                       $status->fatal( 'backend-fail-store', $params['src'], $params['dst'] );
+               if ( $srcHandle === false ) { // source doesn't exist?
+                       $status->fatal( 'backend-fail-notexists', $params['src'] );
 
                        return $status;
                }
 
-               $handle = fopen( $params['src'], 'rb' );
-               if ( $handle === false ) { // source doesn't exist?
-                       $status->fatal( 'backend-fail-store', $params['src'], $params['dst'] );
+               // Compute the MD5 and SHA-1 hashes in one pass
+               $srcSize = fstat( $srcHandle )['size'];
+               $md5Context = hash_init( 'md5' );
+               $sha1Context = hash_init( 'sha1' );
+               $hashDigestSize = 0;
+               while ( !feof( $srcHandle ) ) {
+                       $buffer = (string)fread( $srcHandle, 131072 ); // 128 KiB
+                       hash_update( $md5Context, $buffer );
+                       hash_update( $sha1Context, $buffer );
+                       $hashDigestSize += strlen( $buffer );
+               }
+               // Reset the handle back to the beginning so that it can be streamed
+               rewind( $srcHandle );
+
+               if ( $hashDigestSize !== $srcSize ) {
+                       $status->fatal( 'backend-fail-hash', $params['src'] );
 
                        return $status;
                }
@@ -339,12 +355,13 @@ class SwiftFileBackend extends FileBackendStore {
                        'headers' => array_merge(
                                $mutableHeaders,
                                [
-                                       'content-length' => fstat( $handle )['size'],
-                                       'etag' => md5_file( $params['src'] ),
-                                       'x-object-meta-sha1base36' => Wikimedia\base_convert( $sha1Base16, 16, 36, 31 )
+                                       'content-length' => $srcSize,
+                                       'etag' => hash_final( $md5Context ),
+                                       'x-object-meta-sha1base36' =>
+                                               Wikimedia\base_convert( hash_final( $sha1Context ), 16, 36, 31 )
                                ]
                        ),
-                       'body' => $handle // resource
+                       'body' => $srcHandle // resource
                ] ];
 
                $method = __METHOD__;
@@ -362,7 +379,7 @@ class SwiftFileBackend extends FileBackendStore {
                };
 
                $opHandle = new SwiftFileOpHandle( $this, $handler, $reqs );
-               $opHandle->resourcesToClose[] = $handle;
+               $opHandle->resourcesToClose[] = $srcHandle;
 
                if ( !empty( $params['async'] ) ) { // deferred
                        $status->value = $opHandle;
index 0783068..7b73902 100644 (file)
@@ -393,6 +393,7 @@ class UserMailer {
                                Wikimedia\restoreWarnings();
                                return Status::newFatal( 'pear-mail-error', $mail_object->getMessage() );
                        }
+                       '@phan-var Mail_smtp $mail_object';
 
                        wfDebug( "Sending mail via PEAR::Mail\n" );
 
index 2f3fac2..ff7ee4b 100644 (file)
@@ -27,7 +27,6 @@ use MovePage;
 use NamespaceInfo;
 use RepoGroup;
 use Title;
-use WatchedItemStore;
 use WatchedItemStoreInterface;
 use Wikimedia\Rdbms\ILoadBalancer;
 
@@ -44,7 +43,7 @@ class MovePageFactory {
        /** @var NamespaceInfo */
        private $nsInfo;
 
-       /** @var WatchedItemStore */
+       /** @var WatchedItemStoreInterface */
        private $watchedItems;
 
        /** @var PermissionManager */
index d4f66f7..597f851 100644 (file)
@@ -35,6 +35,7 @@ class PPDPart_Hash extends PPDPart {
                } else {
                        $accum = [];
                }
+               // @phan-suppress-next-line PhanTypeMismatchArgument
                parent::__construct( $accum );
        }
 }
index 956bdab..571b6e4 100644 (file)
@@ -168,6 +168,7 @@ class SiteImporter {
                $pathTags = $siteElement->getElementsByTagName( 'path' );
                for ( $i = 0; $i < $pathTags->length; $i++ ) {
                        $pathElement = $pathTags->item( $i );
+                       '@phan-var DOMElement $pathElement';
                        $pathType = $this->getAttributeValue( $pathElement, 'type' );
                        $path = $pathElement->textContent;
 
@@ -177,6 +178,7 @@ class SiteImporter {
                $idTags = $siteElement->getElementsByTagName( 'localid' );
                for ( $i = 0; $i < $idTags->length; $i++ ) {
                        $idElement = $idTags->item( $i );
+                       '@phan-var DOMElement $idElement';
                        $idType = $this->getAttributeValue( $idElement, 'type' );
                        $id = $idElement->textContent;
 
index 403f5b2..dedf83a 100644 (file)
@@ -756,6 +756,7 @@ abstract class BaseTemplate extends QuickTemplate {
         */
        public function getTrail() {
                return WrappedString::join( "\n", [
+                       // @phan-suppress-next-line PhanTypeMismatchArgument
                        MWDebug::getDebugHTML( $this->getSkin()->getContext() ),
                        $this->get( 'bottomscripts' ),
                        $this->get( 'reporttime' )
index 527b910..8d6488d 100644 (file)
@@ -40,7 +40,7 @@ class SpecialPagesWithProp extends QueryPage {
        private $existingPropNames = null;
 
        /**
-        * @var string|null
+        * @var int|null
         */
        private $ns;
 
@@ -69,6 +69,7 @@ class SpecialPagesWithProp extends QueryPage {
 
                $request = $this->getRequest();
                $propname = $request->getVal( 'propname', $par );
+               $this->ns = $request->getIntOrNull( 'namespace' );
                $this->reverse = $request->getBool( 'reverse' );
                $this->sortByValue = $request->getBool( 'sortbyvalue' );
 
@@ -87,8 +88,8 @@ class SpecialPagesWithProp extends QueryPage {
                                'type' => 'namespaceselect',
                                'name' => 'namespace',
                                'label-message' => 'namespace',
-                               'all' => null,
-                               'default' => null,
+                               'all' => '',
+                               'default' => $this->ns,
                        ],
                        'reverse' => [
                                'type' => 'check',
@@ -120,7 +121,6 @@ class SpecialPagesWithProp extends QueryPage {
 
        public function onSubmit( $data, $form ) {
                $this->propName = $data['propname'];
-               $this->ns = $data['namespace'];
                parent::execute( $data['propname'] );
        }
 
@@ -167,7 +167,7 @@ class SpecialPagesWithProp extends QueryPage {
                        'options' => []
                ];
 
-               if ( $this->ns && isset( $this->ns ) ) {
+               if ( $this->ns !== null ) {
                        $query['conds']['page_namespace'] = $this->ns;
                }
 
index 58360c8..884bd4d 100644 (file)
@@ -64,7 +64,7 @@
        "tog-watchmoves": "Přidávat mnou přesouvané stránky a soubory mezi sledované",
        "tog-watchdeletion": "Přidávat stránky a soubory, které smažu, mezi sledované",
        "tog-watchuploads": "Přidávat mnou načtené soubory ke sledovaným",
-       "tog-watchrollback": "Přidávat stránky, které jsem {{GENDER:|vrátil|vrátila}} zpět, ke sledovaným",
+       "tog-watchrollback": "Přidávat stránky, kde jsem {{GENDER:|použil|použila}} vrácení zpět, ke sledovaným",
        "tog-minordefault": "Označovat editace implicitně jako malé",
        "tog-previewontop": "Zobrazovat náhled před editačním oknem (ne za ním)",
        "tog-previewonfirst": "Zobrazit při první editaci náhled",
@@ -92,7 +92,7 @@
        "tog-norollbackdiff": "Po vrácení změny nezobrazovat porovnání rozdílů",
        "tog-useeditwarning": "Upozornit, když budu opouštět editaci bez uložení změn",
        "tog-prefershttps": "Po přihlášení vždy používat zabezpečené připojení",
-       "tog-showrollbackconfirmation": "Při kliknutí na odkaz pro vrácení editace zobrazit žádost o potvrzení",
+       "tog-showrollbackconfirmation": "Při kliknutí na odkaz pro rychlý revert zobrazit žádost o potvrzení",
        "tog-requireemail": "Pro obnovu hesla vyžadovat e-mail",
        "underline-always": "Vždy",
        "underline-never": "Nikdy",
        "category_header": "Stránky v kategorii „$1“",
        "subcategories": "Podkategorie",
        "category-media-header": "Soubory v kategorii „$1“",
-       "category-empty": "''Tato kategorie neobsahuje žádné stránky či soubory.''",
+       "category-empty": "<em>Tato kategorie neobsahuje žádné stránky či soubory.</em>",
        "hidden-categories": "{{PLURAL:$1|Skrytá kategorie|Skryté kategorie|Skryté kategorie}}",
        "hidden-category-category": "Skryté kategorie",
        "category-subcat-count": "{{PLURAL:$2|V této kategorii je pouze následující podkategorie.|{{PLURAL:$1|Zobrazuje se jedna podkategorie|Zobrazují se $1 podkategorie|Zobrazuje se $1 podkategorií}} z celkového počtu $2 podkategorií v této kategorii.|{{PLURAL:$1|Zobrazuje se jedna podkategorie|Zobrazují se $1 podkategorie|Zobrazuje se $1 podkategorií}} z celkového počtu $2 podkategorií v této kategorii.}}",
index dad1eb8..5c60cff 100644 (file)
        "listfiles-userdoesnotexist": "Das Benutzerkonto „$1“ ist nicht registriert.",
        "imgfile": "Datei",
        "listfiles": "Dateiliste",
+       "listfiles_subpage": "Von $1 hochgeladene Dateien",
        "listfiles_thumb": "Vorschaubild",
        "listfiles_date": "Datum",
        "listfiles_name": "Name",
        "mycustomjsredirectprotected": "Du hast keine Berechtigung, diese JavaScript-Seite zu bearbeiten, da sie eine Weiterleitung, die nicht in deinen Benutzernamensraum zeigt, enthält.",
        "easydeflate-invaliddeflate": "Der angegebene Inhalt ist nicht ordnungsgemäß komprimiert",
        "unprotected-js": "Aus Sicherheitsgründen kann JavaScript-Code nicht mehr von ungeschützten Seiten geladen werden. Erstelle die JavaScript-Seite bitte ausschließlich im Namensraum „MediaWiki“ oder als Benutzerunterseite.",
-       "userlogout-continue": "Möchtest du dich abmelden?"
+       "userlogout-continue": "Möchtest du dich abmelden?",
+       "rest-prefix-mismatch": "Der angeforderte Pfad ($1) kannte nicht innerhalb des REST-API-Root-Pfades ($2) gefunden werden"
 }
index 601106d..8ac0ac4 100644 (file)
        "upload_directory_read_only": "Direktorê dosyayê ($1)î webserver de nieşkeno binuse.",
        "uploaderror": "Ğeletê bar kerdişî",
        "upload-recreate-warning": "'''Diqet: Yew dosya pê ena name wedariya ya zi vurniya.'''\n\nLogê wedariyayiş u berdişi seba ena pele a ti ra xezir kerda:",
-       "uploadtext": "Qey barkerdişê dosyayî, formê cêrinî bişuxulne.\nDosyayê ke vera cû bar biyê eke şima qayîl e ney dosyayan bivînê ya zî bigerî biewnê[[Special:FileList|listeyê dosyayê bar bîyaye]] (tekrar) bar bîyaye [[Special:Log/upload|rocaneyê barkerdişî]] de, hewn a şîyaye zî tîya de [[Special:Log/delete|rocaneyê hewn a kerdişî]] pawiyene.\n\nwexta şima qayîl e yew peli re dosya bierzî, formanê cêrinan ra yewi bişuxulne;\n* Qey xebitnayişê dosyayî: '''<code><nowiki>[[</nowiki>{{ns:file}}<nowiki>:Dosya.jpg]]</nowiki></code>'''\n*Heto çep de zerreyê yew qutî de, qey xebitnayişi 'nuşteyê binîn' û 200 pikseli: '''<code><nowiki>[[</nowiki>{{ns:file}}<nowiki>:Dosya.png|200px|thumb|left|alt metin]]</nowiki></code>'''\n* Dosya memocın, dosya te direk gırey bıerz: '''<code><nowiki>[[</nowiki>{{ns:media}}<nowiki>:Dosya.ogg]]</nowiki></code>'''",
+       "uploadtext": "Seba '''dosya''' barkerdışi rê formê cerênê bıkarnê. Veri ra bar bıyaye dosyaya vınayış  u cıgeyrayışi rê bıewni rê [[Special:FileList|lista dosyayan]], seba (fına ) barbıyayan rê [[Special:Log/upload|roceka barkerdışi ]] u, esterıtan zi pela [[Special:Log/delete|roceka esterıtışi]] de tepışiyeno.\n\nYew pela rê Dosya cıkerdışi rê formanê cêrênan ra yewi bıkarnê;\n* Versiyonê pêroyiya Dosya karnayışi rê: '''<code><nowiki>[[</nowiki>{{ns:file}}<nowiki>:Dosya.jpg]]</nowiki></code>'''\n* Kışta çepa yew dorek miyan de, vıniyao cı de  'metinê bıni' ya, 200 piksel ebatiya Dosya karnayışi rê : '''<code><nowiki>[[</nowiki>{{ns:file}}<nowiki>:Dosya.png|200px|thumb|left|alt metin]]</nowiki></code>'''\n* Dosyay nêmusnayışi ra, Dosya rê direkt Link dayışi rê : '''<code><nowiki>[[</nowiki>{{ns:media}}<nowiki>:Dosya.ogg]]</nowiki></code>'''",
        "upload-permitted": "{{PLURAL:$2|Babetê|Babetên}} dosyayanê vêrdeyan: $1.",
        "upload-preferred": "{{PLURAL:$2|Babetê|Babetên}} dosyayanê tercihbiyayeyan: $1.",
        "upload-prohibited": "{{PLURAL:$2|Babetê|Babetên}} dosyayanê tometebiyayeyan: $1.",
index e387b77..74bc787 100644 (file)
        "exif-gpsspeed": "Хәрәкәт тизлеге",
        "exif-gpsdatestamp": "GPS датасы",
        "exif-keywords": "Иң мөһиме",
+       "exif-countrydest": "Күрсәтелгән ил",
+       "exif-countrycodedest": "Күрсәтелгән илнең коды",
+       "exif-provinceorstatedest": "Күрсәтелгән өлкә яки штат",
+       "exif-citydest": "Күрсәтелгән шәһәр",
+       "exif-sublocationdest": "Күрсәтелгән шәһәрнең җире",
+       "exif-objectname": "Кыска исем",
        "exif-headline": "Башисем",
        "exif-source": "Чыганак",
        "exif-contact": "Элемтә өчен мәгълүмат",
        "exif-iimversion": "IIM юрамасы",
        "exif-iimcategory": "Төркем",
        "exif-iimsupplementalcategory": "Өстәмә төркемнәр",
-       "exif-datetimereleased": "ЧÑ\8bгаÑ\80Ñ\8bлÑ\83 вакыты",
+       "exif-datetimereleased": "ЧÑ\8bгаÑ\80Ñ\8bлÑ\8bÑ\88 вакыты",
        "exif-identifier": "Идентификатор",
        "exif-cameraownername": "Камера иясе",
        "exif-label": "Билгеләү",
index 4bb5750..928690b 100644 (file)
        "createaccountmail": "Átmeneti, véletlenszerű jelszó beállítása és kiküldése a megadott e-mail-címre",
        "createaccountmail-help": "A jelszó megismerése nélkül készíthető valaki másnak fiók.",
        "createacct-realname": "Igazi neved (nem kötelező)",
-       "createacct-reason": "Indoklás",
+       "createacct-reason": "Indoklás (nyilvánosan naplózva)",
        "createacct-reason-ph": "Miért hozol létre egy másik fiókot",
        "createacct-reason-help": "A fióklétrehozási naplóban megjelenő üzenet",
        "createacct-submit": "Felhasználói fiók létrehozása",
        "uploadstash-zero-length": "A fájl nulla méretű.",
        "invalid-chunk-offset": "Érvénytelen darab eltolás",
        "img-auth-accessdenied": "Hozzáférés megtagadva",
-       "img-auth-nopathinfo": "Hiányzó PATH_INFO.\nA szerver nincs beállítva, hogy továbbítsa ezt az információt.\nLehet, hogy CGI-alapú, és nem támogatja az img_auth-ot.\nLásd https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Image_Authorization!",
+       "img-auth-nopathinfo": "Hiányzó elérési út információ.\nA szerveredet úgy kell beállítanod, hogy továbbítsa a REQUEST_URI és/vagy a PATH_INFO változókat.\nHa már be vannak, próbáld engedélyezni a $wgUsePathInfo-t.\nLásd https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Image_Authorization!",
        "img-auth-notindir": "A kért elérési út nincs a beállított feltöltési könyvtárban.",
        "img-auth-badtitle": "Nem sikerült érvényes címet készíteni a(z) „$1” szövegből.",
        "img-auth-nofile": "A fájl („$1”) nem létezik.",
        "listfiles-userdoesnotexist": "A(z) „$1” felhasználó nincs regisztrálva.",
        "imgfile": "fájl",
        "listfiles": "Fájllista",
+       "listfiles_subpage": "$1 feltöltései",
        "listfiles_thumb": "Bélyegkép",
        "listfiles_date": "Dátum",
        "listfiles_name": "Név",
index fa88ebd..5cbecc3 100644 (file)
        "listfiles-userdoesnotexist": "L'utenza \"$1\" non è registrata.",
        "imgfile": "file",
        "listfiles": "Elenco dei file",
+       "listfiles_subpage": "Caricamenti di $1",
        "listfiles_thumb": "Miniatura",
        "listfiles_date": "Data",
        "listfiles_name": "Nome",
index 5d12d28..5286b97 100644 (file)
        "emailuser-title-target": "Siųsti el. pašto žinutę {{GENDER:$1|naudotojui|naudotojai}}",
        "emailuser-title-notarget": "El. pašto vartotojas",
        "emailpagetext": "Jūs galite pasinaudoti šiuo pavyzdžiu, norėdami nusiųsti elektroninį laišką {{GENDER:$1|šiam naudotojui|šiai naudotojai}}.\nElektroninio pašto adresas, kurį įvedėte [[Special:Preferences|savo naudotojo nustatymuose]], bus rodomas kaip el. pašto siuntėjo adresas tam, kad gavėjas galėtų tiesiogiai jums atsakyti.",
-       "defemailsubject": "{{SITENAME}} el. pašto iš vartotojo \" $1 \"",
+       "defemailsubject": "{{SITENAME}} laiškas iš naudotojo „$1“",
        "usermaildisabled": "Naudotojo elektroninis paštas išjungtas",
        "usermaildisabledtext": "Jūs negalite siūlsti el. laiško kitiems šio wiki projekto naudotojams.",
        "noemailtitle": "Nėra el. pašto adreso",
index 6382bf4..55ab67b 100644 (file)
        "listfiles-userdoesnotexist": "A conta de usuário \"$1\" não está registrada.",
        "imgfile": "arquivo",
        "listfiles": "Lista de arquivos",
+       "listfiles_subpage": "Enviado por $1",
        "listfiles_thumb": "Miniatura",
        "listfiles_date": "Data",
        "listfiles_name": "Nome",
        "mycustomjsredirectprotected": "Você não tem permissão para editar esta página JavaScript porque é um redirecionamento e não aponta dentro do seu espaço do usuário.",
        "easydeflate-invaliddeflate": "O conteúdo fornecido não está devidamente comprimido",
        "unprotected-js": "Por razões de segurança o JavaScript não pode ser carregado de páginas desprotegidas. Por favor, crie apenas javascript no MediaWiki: namespace ou como uma subpágina do usuário",
-       "userlogout-continue": "Você quer sair?"
+       "userlogout-continue": "Você quer sair?",
+       "rest-prefix-mismatch": "O caminho pedido ($1) não estava no interior do caminho raiz da API REST ($2)",
+       "rest-wrong-method": "O método pedido ($1) não era {{PLURAL:$3|o método permitido para este caminho|um dos métodos permitidos para este caminho}} ($2)",
+       "rest-no-match": "O caminho relativo pedido ($1) não corresponde a nenhuma rotina de tratamento conhecida"
 }
index 03c99c2..00e8f05 100644 (file)
@@ -60,6 +60,7 @@
        "tog-useeditwarning": "Avvisave quanne jie lasse 'na pàgene cangiate senze ca agghie sarvate le cangiaminde",
        "tog-prefershttps": "Ause sembre 'na connessione secure quanne trase",
        "tog-showrollbackconfirmation": "Fà 'ndrucà 'na richieste de conferme quanne ste cazze sus a 'nu collegamende de annullamende",
+       "tog-requireemail": "Richeiste email pe l'azzeramende d'a passuord",
        "underline-always": "Sembre",
        "underline-never": "Maje",
        "underline-default": "Valore de default d'u browser o scheme",
        "content-model-css": "CSS",
        "content-json-empty-object": "Oggette vacande",
        "content-json-empty-array": "Matrice vacande",
+       "unsupported-content-diff": "Le differenze non ge sò supportate pu modelle de condenute $1.",
        "deprecated-self-close-category": "Lè pàggene ca ausane le tag HTML auto-achiuse invalide",
        "duplicate-args-warning": "<strong>Attenziò:</strong> [[:$1]] ste chiame [[:$2]] cu cchiù de 'nu valore pu parametre \"$3\". Sulamende l'urteme valore date avène ausate.",
        "duplicate-args-category": "Pàggene ca ausane le argumende a doppie jndr'à le chiamate d'u template",
        "listfiles-userdoesnotexist": "Nome utende \"$1\" non g'è reggistrate.",
        "imgfile": "file",
        "listfiles": "Liste de le fail",
+       "listfiles_subpage": "Carecaminde da $1",
        "listfiles_thumb": "Miniature",
        "listfiles_date": "Sciurne",
        "listfiles_name": "Nome",
index 2301e11..c9990ed 100644 (file)
        "createaccountmail": "Использовать сгенерированный случайным образом временный пароль и выслать его на указанный адрес электронной почты",
        "createaccountmail-help": "Может использоваться, чтобы создать учётную запись для другого лица, не узнавая пароль.",
        "createacct-realname": "Настоящее имя (необязательно)",
-       "createacct-reason": "Причина",
+       "createacct-reason": "Причина (публично видимая)",
        "createacct-reason-ph": "Зачем вы создаёте другую учётную запись",
        "createacct-reason-help": "Сообщение, отображаемое в журнале создания учётных записей",
        "createacct-submit": "Создать учётную запись",
index 1dc3039..583ef08 100644 (file)
        "createaccountmail": "Використати тимчасовий випадковий пароль і надіслати його на вказану адресу електронної пошти",
        "createaccountmail-help": "Може використовуватися, щоб створити обліковий запис для іншої особи, не дізнаючись пароль.",
        "createacct-realname": "Справжнє ім'я (не обов'язково)",
-       "createacct-reason": "Причина",
+       "createacct-reason": "Причина (публічно видима)",
        "createacct-reason-ph": "Чому ви створюєте інший обліковий запис",
        "createacct-reason-help": "Повідомлення, що показується в журналі створення облікових записів",
        "createacct-submit": "Створіть ваш обліковий запис",
index e084d76..9c00f4f 100644 (file)
        "ipblocklist-legend": "查找被封禁用户",
        "blocklist-userblocks": "隐藏账户封禁",
        "blocklist-tempblocks": "隐藏临时封禁",
+       "blocklist-indefblocks": "隐藏无限期封禁",
        "blocklist-addressblocks": "隐藏单个IP封禁",
        "blocklist-type": "类型:",
        "blocklist-type-opt-all": "全部",
index c607eb0..2bce867 100644 (file)
        "tog-useeditwarning": "在我離開未儲存的編輯頁面時警告我",
        "tog-prefershttps": "登入時永遠使用安全連線",
        "tog-showrollbackconfirmation": "當點擊回退連結時顯示確認提示",
+       "tog-requireemail": "需要電子郵件用來重設密碼",
        "underline-always": "永遠使用",
        "underline-never": "永不使用",
        "underline-default": "佈景主題或瀏覽器預設",
        "createaccountmail": "使用臨時的隨機密碼,並將它寄至指定的電子郵件地址",
        "createaccountmail-help": "可用來建立其他人的帳號 (不需要知道密碼)。",
        "createacct-realname": "真實姓名 (選填)",
-       "createacct-reason": "原因",
+       "createacct-reason": "原因(公開記錄)",
        "createacct-reason-ph": "您為什麼要建立另一個帳號",
        "createacct-reason-help": "顯示於帳號建立日誌的訊息",
        "createacct-submit": "建立您的帳號",
        "changeemail-oldemail": "目前的電子郵件地址:",
        "changeemail-newemail": "新的電子郵件地址:",
        "changeemail-newemail-help": "若您想移除您的電子郵件地址,此欄位應留空。若移除電子郵件地址您將無法重設忘記的密碼並且將不會再收到來自此 wiki 的電子郵件。",
-       "changeemail-none": "(無)",
+       "changeemail-none": "(無)",
        "changeemail-password": "您於 {{SITENAME}} 的密碼:",
        "changeemail-submit": "變更電子郵件",
        "changeemail-throttled": "您最近嘗試了太多次登入。\n請等待 $1 後再試。",
        "undo-main-slot-only": "編輯無法還原,因為有包含到在主分配之外的內容。",
        "undo-norev": "此編輯不存在或已被刪除,無法還原。",
        "undo-nochange": "此編輯已被還原。",
-       "undo-summary": "取消由 [[Special:Contributions/$2|$2]] ([[User talk:$2|討論]]) 所作出的修訂 $1",
+       "undo-summary": "取消由[[Special:Contributions/$2|$2]]([[User talk:$2|討論]])所作出的修訂$1",
+       "undo-summary-anon": "取消由[[Special:Contributions/$2|$2]]所作出的修訂$1",
        "undo-summary-username-hidden": "還原隱藏使用者的修訂 $1",
        "cantcreateaccount-text": "自這個 IP 位址 (<strong>$1</strong>) 建立帳號已經被 [[User:$3|$3]] 封鎖。\n\n$3 封鎖的原因是$2",
        "cantcreateaccount-range-text": "來自 IP 位址範圍 <strong>$1</strong>,包含您的 IP 位址 (<strong>$4</strong>) 所建立的帳號已經被 [[User:$3|$3]] 封鎖。\n\n$3 封鎖的原因是 <em>$2</em>",
        "prefs-help-gender": "此偏好設定為選填欄位。\n系統會使用您選擇的方式稱呼您,對他人提及您時也會使用適當語法稱呼。\n此項資訊會被公開。",
        "email": "Email",
        "prefs-help-realname": "真實姓名為選填欄位。\n若提供,真實姓名可能會用來作為您的作品的署名。",
-       "prefs-help-email": "電子郵件地址為選填欄位。\n但在重設密碼時會使用,而您很有可能會忘記密碼。",
+       "prefs-help-email": "電子郵件地址為選填欄位,但是當您忘記密碼而要重設時需要此資訊。",
        "prefs-help-email-others": "您亦可以選擇讓其他使用者透過您的電子郵件、使用者頁面或討論頁面的連結與您聯絡。\n您的電子郵件地址不會洩漏給其他要聯絡您的使用者。",
        "prefs-help-email-required": "電子郵件地址是必填項目。",
+       "prefs-help-requireemail": "如果選取,則只有在重設密碼的人同時提供此帳戶的使用者名稱和電子郵件時,才會發送重設密碼的電子郵件。",
        "prefs-info": "基本資訊",
        "prefs-i18n": "國際化",
        "prefs-signature": "簽名",
        "listfiles-userdoesnotexist": "使用者帳號 \"$1\" 尚未註冊。",
        "imgfile": "檔案",
        "listfiles": "檔案清單",
+       "listfiles_subpage": "由 $1 上傳",
        "listfiles_thumb": "縮圖",
        "listfiles_date": "日期",
        "listfiles_name": "名稱",
        "alreadyrolled": "無法回退由[[User:$2|$2]]([[User talk:$2|討論]]{{int:pipe-separator}}[[Special:Contributions/$2|{{int:contribslink}}]])所作的最後一次編輯[[:$1]],已有其他人編輯或回退了該頁面。\n\n最後一次編輯該頁面的使用者是[[User:$3|$3]]([[User talk:$3|討論]]{{int:pipe-separator}}[[Special:Contributions/$3|{{int:contribslink}}]])。",
        "editcomment": "編輯摘要為:<em>$1</em>。",
        "revertpage": "已還原[[Special:Contributions/$2|$2]]([[User talk:$2|討論]])的編輯至最後由[[User:$1|$1]]所修訂的版本",
+       "revertpage-anon": "已還原[[Special:Contributions/$2|$2]]的編輯至最後由[[User:$1|$1]]所修訂的版本",
        "revertpage-nouser": "已還原隱藏使用者的編輯為最後 {{GENDER:$1|[[User:$1|$1]]}} 修訂的版本",
        "rollback-success": "已還原{{GENDER:$3|$1}}所做的編輯;變更回由{{GENDER:$4|$2}}修訂的最後一個版本。",
        "sessionfailure-title": "連線階段失敗",
        "ipblocklist-legend": "搜尋已封鎖的使用者",
        "blocklist-userblocks": "隱藏帳號封鎖",
        "blocklist-tempblocks": "隱藏暫時封鎖",
+       "blocklist-indefblocks": "隱藏無限期封鎖",
        "blocklist-addressblocks": "隱藏單一 IP 封鎖",
        "blocklist-type": "類型:",
        "blocklist-type-opt-all": "所有",
        "mycustomjsredirectprotected": "您無權編輯此JavaScript頁面,因為它是重新導向,且不是重新導向到您的用戶空間。",
        "easydeflate-invaliddeflate": "提供的內容未被正常的壓縮",
        "unprotected-js": "基於安全因素,JavaScript 不能從未保護的頁面來載入。請僅在 MediaWiki:命名空間或使用者子頁面中建立 JavaScript。",
-       "userlogout-continue": "您想要登出嗎?"
+       "userlogout-continue": "您想要登出嗎?",
+       "rest-prefix-mismatch": "請求的路徑($1)不在REST API的根路徑($2)內",
+       "rest-wrong-method": "請求的方法($1)不是{{PLURAL:$3|此路徑允許的方法|此路徑允許的方法之一}}($2)",
+       "rest-no-match": "請求的相對路徑($1)不符合任何已知的處理器"
 }
index b63a2e2..c1a1b07 100644 (file)
@@ -52,7 +52,7 @@ class AddChangeTag extends Maintenance {
                );
 
                if ( !$status->isGood() ) {
-                       $this->fatalError( $status->getWikiText( null, null, 'en' ) );
+                       $this->fatalError( $status->getMessage( false, false, 'en' )->text() );
                }
 
                $this->output( "$tag was created.\n" );
index e7df448..aa45154 100644 (file)
@@ -60,7 +60,7 @@ class ChangePassword extends Maintenance {
                if ( $status->isGood() ) {
                        $this->output( "Password set for " . $user->getName() . "\n" );
                } else {
-                       $this->fatalError( $status->getWikiText( null, null, 'en' ) );
+                       $this->fatalError( $status->getMessage( false, false, 'en' )->text() );
                }
        }
 }
index da241e5..2c81adf 100644 (file)
@@ -163,7 +163,7 @@ class CleanupCaps extends TableCleanup {
                        $mp = MediaWikiServices::getInstance()->getMovePageFactory()
                                ->newMovePage( $current, $target );
                        $status = $mp->move( $this->user, $reason, $createRedirect );
-                       $ok = $status->isOK() ? 'OK' : $status->getWikiText( false, false, 'en' );
+                       $ok = $status->isOK() ? 'OK' : $status->getMessage( false, false, 'en' )->text();
                        $this->output( "\"$display\" -> \"$targetDisplay\": $ok\n" );
                }
 
index ce40638..9e36742 100644 (file)
@@ -260,7 +260,7 @@ class CopyFileBackend extends Maintenance {
                        // Note: prepare() is usually fast for key/value backends
                        $status = $dst->prepare( [ 'dir' => dirname( $dstPath ), 'bypassReadOnly' => 1 ] );
                        if ( !$status->isOK() ) {
-                               $this->error( print_r( Status::wrap( $status )->getWikiText(), true ) );
+                               $this->error( Status::wrap( $status )->getMessage( false, false, 'en' )->text() );
                                $this->fatalError( "$domainId: Could not copy $srcPath to $dstPath." );
                        }
                        $ops[] = [ 'op' => 'store',
@@ -277,7 +277,7 @@ class CopyFileBackend extends Maintenance {
                }
                $elapsed_ms = floor( ( microtime( true ) - $t_start ) * 1000 );
                if ( !$status->isOK() ) {
-                       $this->error( print_r( Status::wrap( $status )->getWikiText(), true ) );
+                       $this->error( Status::wrap( $status )->getMessage( false, false, 'en' )->text() );
                        $this->fatalError( "$domainId: Could not copy file batch." );
                } elseif ( count( $copiedRel ) ) {
                        $this->output( "\n\tCopied these file(s) [{$elapsed_ms}ms]:\n\t" .
@@ -314,7 +314,7 @@ class CopyFileBackend extends Maintenance {
                }
                $elapsed_ms = floor( ( microtime( true ) - $t_start ) * 1000 );
                if ( !$status->isOK() ) {
-                       $this->error( print_r( Status::wrap( $status )->getWikiText(), true ) );
+                       $this->error( Status::wrap( $status )->getMessage( false, false, 'en' )->text() );
                        $this->fatalError( "$domainId: Could not delete file batch." );
                } elseif ( count( $deletedRel ) ) {
                        $this->output( "\n\tDeleted these file(s) [{$elapsed_ms}ms]:\n\t" .
index 505168e..b92735b 100644 (file)
@@ -121,7 +121,7 @@ class CreateAndPromote extends Maintenance {
                                false
                        );
                        if ( !$status->isGood() ) {
-                               $this->fatalError( $status->getWikiText( null, null, 'en' ) );
+                               $this->fatalError( $status->getMessage( false, false, 'en' )->text() );
                        }
                }
 
@@ -134,7 +134,7 @@ class CreateAndPromote extends Maintenance {
                                        'retype' => $password,
                                ] );
                                if ( !$status->isGood() ) {
-                                       throw new PasswordError( $status->getWikiText( null, null, 'en' ) );
+                                       throw new PasswordError( $status->getMessage( false, false, 'en' )->text() );
                                }
                                if ( $exists ) {
                                        $this->output( "Password set.\n" );
index 3609cf2..825e9ca 100644 (file)
@@ -122,7 +122,7 @@ class EditCLI extends Maintenance {
                        $exit = 1;
                }
                if ( !$status->isGood() ) {
-                       $this->output( $status->getWikiText( false, false, 'en' ) . "\n" );
+                       $this->output( $status->getMessage( false, false, 'en' )->text() . "\n" );
                }
                exit( $exit );
        }
index d5f94ad..6640148 100644 (file)
@@ -326,7 +326,7 @@ TEXT
                        $statusRootPage = $importer->setTargetRootPage( $this->getOption( 'rootpage' ) );
                        if ( !$statusRootPage->isGood() ) {
                                // Die here so that it doesn't print "Done!"
-                               $this->fatalError( $statusRootPage->getMessage()->text() );
+                               $this->fatalError( $statusRootPage->getMessage( false, false, 'en' )->text() );
                                return false;
                        }
                }
index 954f36d..0c4ff0a 100644 (file)
@@ -326,7 +326,7 @@ class ImportImages extends Maintenance {
                                        $archive = $image->publish( $file, $flags, $publishOptions );
                                        if ( !$archive->isGood() ) {
                                                $this->output( "failed. (" .
-                                                        $archive->getWikiText( false, false, 'en' ) .
+                                                        $archive->getMessage( false, false, 'en' )->text() .
                                                         ")\n" );
                                                $failed++;
                                                continue;
index 16b8ccf..20254b0 100644 (file)
@@ -118,7 +118,7 @@ class CommandLineInstaller extends Maintenance {
                try {
                        $installer = InstallerOverrides::getCliInstaller( $siteName, $adminName, $this->mOptions );
                } catch ( \MediaWiki\Installer\InstallException $e ) {
-                       $this->output( $e->getStatus()->getMessage()->text() . "\n" );
+                       $this->output( $e->getStatus()->getMessage( false, false, 'en' )->text() . "\n" );
                        return false;
                }
 
index 09f3120..b54ed45 100644 (file)
@@ -111,7 +111,7 @@ class MoveBatch extends Maintenance {
                                ->newMovePage( $source, $dest );
                        $status = $mp->move( $wgUser, $reason, !$noredirects );
                        if ( !$status->isOK() ) {
-                               $this->output( "\nFAILED: " . $status->getWikiText( false, false, 'en' ) );
+                               $this->output( "\nFAILED: " . $status->getMessage( false, false, 'en' )->text() );
                        }
                        $this->commitTransaction( $dbw, __METHOD__ );
                        $this->output( "\n" );
index db8a19a..264ba57 100644 (file)
@@ -143,6 +143,10 @@ class RefreshFileHeaders extends Maintenance {
                $this->output( "Done. Updated headers for $count file(s).\n" );
        }
 
+       /**
+        * @param LocalRepo $repo
+        * @param array $backendOperations
+        */
        protected function updateFileHeaders( $repo, $backendOperations ) {
                $status = $repo->getBackend()->doQuickOperations( $backendOperations );
 
index 667c2ba..a36e409 100644 (file)
@@ -24,7 +24,7 @@
                this.drawCarousel();
                this.setSizeRequirement();
                this.toggleThumbnails( !!this.$gallery.attr( 'data-showthumbnails' ) );
-               this.showCurrentImage();
+               this.showCurrentImage( true );
 
                // Events
                $( window ).on(
 
        /**
         * Displays the image set as {@link #$currentImage} in the carousel.
+        *
+        * @param {boolean} init Image being show during gallery init (i.e. first image)
         */
-       mw.GallerySlideshow.prototype.showCurrentImage = function () {
+       mw.GallerySlideshow.prototype.showCurrentImage = function ( init ) {
                var $thumbnail, $imgLink,
                        $imageLi = this.getCurrentImage(),
                        $caption = $imageLi.find( '.gallerytext' );
                        if ( this.$thumbnail.attr( 'src' ) === $thumbnail.attr( 'src' ) ) {
                                this.$img.attr( 'src', info.thumburl );
                                this.setImageSize();
-                               mw.hook( 'wikipage.content' ).fire( this.$imgContainer );
+                               // Don't fire hook twice during init
+                               if ( !init ) {
+                                       mw.hook( 'wikipage.content' ).fire( this.$imgContainer );
+                               }
 
                                // Pre-fetch the next image
                                this.loadImage( this.getNextImage().find( 'img' ) );
index 4541c58..a0ac0ca 100644 (file)
                        // Generate the same URL on client side as the one generated in ImagePage::openShowImage.
                        // We avoid using the URL in the link directly since it could have been manipulated (T68608)
                        page = Number( mw.util.getParamValue( 'page', this.href ) );
-                       url = mw.util.getUrl( mw.config.get( 'wgPageName' ), { page: page } );
+                       url = mw.util.getUrl( null, { page: page } );
 
                        switchPage( url );
                        e.preventDefault();
index ce3f2e2..ca400bf 100644 (file)
@@ -45,6 +45,6 @@ trait MediaWikiCoversValidator {
                        }
                }
 
-               $this->assertEquals( '', $bad );
+               $this->assertSame( '', $bad );
        }
 }
index 6120467..27cbed5 100644 (file)
@@ -1821,27 +1821,30 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
        /**
         * Empty all tables so they can be repopulated for tests
         *
-        * @param Database $db|null Database to reset
-        * @param array $tablesUsed Tables to reset
+        * @param IDatabase $db|null Database to reset
+        * @param string[] $tablesUsed Tables to reset
         */
-       private function resetDB( $db, $tablesUsed ) {
+       private function resetDB( IDatabase $db = null, array $tablesUsed ) {
                if ( $db ) {
-                       $userTables = [ 'user', 'user_groups', 'user_properties', 'actor' ];
-                       $pageTables = [
-                               'page', 'revision', 'ip_changes', 'revision_comment_temp', 'comment', 'archive',
-                               'revision_actor_temp', 'slots', 'content', 'content_models', 'slot_roles',
-                               'change_tag',
-                       ];
-                       $loggingTables = [
-                               'logging', 'log_search', 'change_tag',
+                       // some groups of tables are connected such that if any is used, all should be cleared
+                       $extraTables = [
+                               'user' => [ 'user', 'user_groups', 'user_properties', 'actor' ],
+                               'page' => [ 'page', 'revision', 'ip_changes', 'revision_comment_temp', 'comment', 'archive',
+                                       'revision_actor_temp', 'slots', 'content', 'content_models', 'slot_roles',
+                                       'change_tag' ],
+                               'logging' => [ 'logging', 'log_search', 'change_tag' ],
                        ];
-                       $coreDBDataTables = array_merge( $userTables, $pageTables );
+                       $coreDBDataTables = array_merge( $extraTables['user'], $extraTables['page'] );
 
-                       // some groups of tables are connected such that if any is used, all should be cleared
-                       $extraTables = [];
-                       if ( array_intersect( $tablesUsed, $userTables ) ) {
-                               $extraTables[] = $userTables;
+                       foreach ( $extraTables as $i => $group ) {
+                               if ( !array_intersect( $tablesUsed, $group ) ) {
+                                       unset( $extraTables[$i] );
+                               }
+                       }
+                       $extraTables = array_values( $extraTables );
+                       $tablesUsed = array_unique( array_merge( $tablesUsed, ...$extraTables ) );
 
+                       if ( in_array( 'user', $tablesUsed ) ) {
                                TestUserRegistry::clear();
 
                                // Reset $wgUser, which is probably 127.0.0.1, as its loaded data is probably not valid
@@ -1850,15 +1853,6 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
                                global $wgUser;
                                $wgUser->clearInstanceCache( $wgUser->mFrom );
                        }
-                       if ( array_intersect( $tablesUsed, $pageTables ) ) {
-                               $extraTables[] = $pageTables;
-                       }
-                       if ( array_intersect( $tablesUsed, $loggingTables ) ) {
-                               $extraTables[] = $loggingTables;
-                       }
-                       if ( $extraTables !== [] ) {
-                               $tablesUsed = array_unique( array_merge( $tablesUsed, ...$extraTables ) );
-                       }
 
                        // Postgres uses mwuser/pagecontent
                        // instead of user/text. But Postgres does not remap the
index d2540f6..1f9465d 100644 (file)
@@ -351,7 +351,7 @@ class EditPageTest extends MediaWikiLangTestCase {
 
                wfGetDB( DB_MASTER )->commit( __METHOD__ );
 
-               $this->assertEquals( 0, DeferredUpdates::pendingUpdatesCount(), 'No deferred updates' );
+               $this->assertSame( 0, DeferredUpdates::pendingUpdatesCount(), 'No deferred updates' );
 
                if ( $expectedCode != EditPage::AS_BLANK_ARTICLE ) {
                        $latest = $page->getLatest();
index c054caa..7b7f6b9 100644 (file)
@@ -50,7 +50,7 @@ class FauxRequestTest extends PHPUnit\Framework\TestCase {
        public function testGetText() {
                $req = new FauxRequest( [ 'x' => 'Value' ] );
                $this->assertEquals( 'Value', $req->getText( 'x' ) );
-               $this->assertEquals( '', $req->getText( 'z' ) );
+               $this->assertSame( '', $req->getText( 'z' ) );
        }
 
        /**
@@ -287,8 +287,8 @@ class FauxRequestTest extends PHPUnit\Framework\TestCase {
         */
        public function testDummies() {
                $req = new FauxRequest();
-               $this->assertEquals( '', $req->getRawQueryString() );
-               $this->assertEquals( '', $req->getRawPostString() );
-               $this->assertEquals( '', $req->getRawInput() );
+               $this->assertSame( '', $req->getRawQueryString() );
+               $this->assertSame( '', $req->getRawPostString() );
+               $this->assertSame( '', $req->getRawInput() );
        }
 }
index 5d83b7e..4401410 100644 (file)
@@ -161,12 +161,12 @@ class HtmlTest extends MediaWikiTestCase {
         * @covers Html::expandAttributes
         */
        public function testExpandAttributesForBooleans() {
-               $this->assertEquals(
+               $this->assertSame(
                        '',
                        Html::expandAttributes( [ 'selected' => false ] ),
                        'Boolean attributes do not generates output when value is false'
                );
-               $this->assertEquals(
+               $this->assertSame(
                        '',
                        Html::expandAttributes( [ 'selected' => null ] ),
                        'Boolean attributes do not generates output when value is null'
index fe32507..dcac471 100644 (file)
@@ -453,7 +453,7 @@ class LinkerTest extends MediaWikiLangTestCase {
                $user = $context->getUser();
                $user->setOption( 'showrollbackconfirmation', $rollbackEnabled );
 
-               $this->assertEquals( 0, Title::newFromText( $title )->getArticleID() );
+               $this->assertSame( 0, Title::newFromText( $title )->getArticleID() );
                $pageData = $this->insertPage( $title );
                $page = WikiPage::factory( $pageData['title'] );
 
index d34ba0a..e4c068f 100644 (file)
@@ -227,7 +227,7 @@ class MediaWikiServicesTest extends MediaWikiTestCase {
 
                // This should do nothing. In particular, it should not create a service instance.
                $services->resetServiceForTesting( 'Test' );
-               $this->assertEquals( 0, $serviceCounter, 'No service instance should be created yet.' );
+               $this->assertSame( 0, $serviceCounter, 'No service instance should be created yet.' );
 
                $oldInstance = $services->getService( 'Test' );
                $this->assertEquals( 1, $serviceCounter, 'A service instance should exit now.' );
index aa6e494..6ab56eb 100644 (file)
@@ -93,7 +93,7 @@ class OutputPageTest extends MediaWikiTestCase {
                                'Some syndication links should be there' );
                } else {
                        $this->assertFalse( $outputPage->isSyndicated(), 'No syndication should be offered' );
-                       $this->assertEquals( 0, count( $outputPage->getSyndicationLinks() ),
+                       $this->assertSame( 0, count( $outputPage->getSyndicationLinks() ),
                                'No syndication links should be there' );
                }
        }
index c0ff44b..e4d6b54 100644 (file)
@@ -3,12 +3,17 @@
 namespace MediaWiki\Tests\Revision;
 
 use CommentStoreComment;
+use ContentHandler;
 use MediaWiki\MediaWikiServices;
 use MediaWiki\Revision\MutableRevisionRecord;
 use MediaWiki\Revision\RevisionRecord;
 use MediaWiki\Revision\SlotRecord;
+use MediaWiki\Storage\SqlBlobStore;
+use Revision;
+use StatusValue;
 use TextContent;
 use Title;
+use Wikimedia\TestingAccessWrapper;
 use WikitextContent;
 
 /**
@@ -239,4 +244,49 @@ class McrRevisionStoreDbTest extends RevisionStoreDbTestBase {
                        ]
                ] ], $result->getErrors() );
        }
+
+       /**
+        * @covers \MediaWiki\Revision\RevisionStore::newRevisionsFromBatch
+        */
+       public function testNewRevisionFromBatchUsesGetBlobBatch() {
+               $page1 = $this->getTestPage();
+               $text = __METHOD__ . 'b-ä';
+               $editStatus = $this->editPage( $page1->getTitle()->getPrefixedDBkey(), $text . '1' );
+               $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 1' );
+               /** @var Revision $rev1 */
+               $rev1 = $editStatus->getValue()['revision'];
+
+               $contentAddress = $rev1->getRevisionRecord()->getSlot( SlotRecord::MAIN )->getAddress();
+               $mockBlobStore = $this->getMockBuilder( SqlBlobStore::class )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+               $mockBlobStore
+                       ->expects( $this->once() )
+                       ->method( 'getBlobBatch' )
+                       ->with( [ $contentAddress ], $this->anything() )
+                       ->willReturn( StatusValue::newGood( [
+                               $contentAddress => 'Content_From_Mock'
+                       ] ) );
+               $mockBlobStore
+                       ->expects( $this->never() )
+                       ->method( 'getBlob' );
+
+               $revStore = MediaWikiServices::getInstance()
+                       ->getRevisionStoreFactory()
+                       ->getRevisionStore();
+               $wrappedRevStore = TestingAccessWrapper::newFromObject( $revStore );
+               $wrappedRevStore->blobStore = $mockBlobStore;
+
+               $result = $revStore->newRevisionsFromBatch(
+                       [ $this->revisionToRow( $rev1 ) ],
+                       [
+                               'slots' => [ SlotRecord::MAIN ],
+                               'content' => true
+                       ]
+               );
+               $this->assertTrue( $result->isGood() );
+               $this->assertSame( 'Content_From_Mock',
+                       ContentHandler::getContentText( $result->getValue()[$rev1->getId()]
+                               ->getContent( SlotRecord::MAIN ) ) );
+       }
 }
index 76190e0..4040ffc 100644 (file)
@@ -4,8 +4,10 @@ namespace MediaWiki\Tests\Revision;
 
 use CommentStoreComment;
 use Content;
+use ContentHandler;
 use Exception;
 use HashBagOStuff;
+use IDBAccessObject;
 use InvalidArgumentException;
 use Language;
 use MediaWiki\Linker\LinkTarget;
@@ -105,7 +107,7 @@ abstract class RevisionStoreDbTestBase extends MediaWikiTestCase {
         * @return WikiPage
         */
        protected function getTestPage( $pageTitle = null ) {
-               if ( !is_null( $pageTitle ) && $this->testPage ) {
+               if ( is_null( $pageTitle ) && $this->testPage ) {
                        return $this->testPage;
                }
 
@@ -1992,23 +1994,17 @@ abstract class RevisionStoreDbTestBase extends MediaWikiTestCase {
        ) {
                $page1 = $this->getTestPage();
                $text = __METHOD__ . 'b-ä';
+               $editStatus = $this->editPage( $page1->getTitle()->getPrefixedDBkey(), $text . '1' );
+               $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 1' );
                /** @var Revision $rev1 */
-               $rev1 = $page1->doEditContent(
-                       new WikitextContent( $text . '1' ),
-                       __METHOD__ . 'b',
-                       0,
-                       false,
-                       $this->getTestUser()->getUser()
-               )->value['revision'];
+               $rev1 = $editStatus->getValue()['revision'];
+
                $page2 = $this->getTestPage( $otherPageTitle );
+               $editStatus = $this->editPage( $page2->getTitle()->getPrefixedDBkey(), $text . '2' );
+               $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 2' );
                /** @var Revision $rev2 */
-               $rev2 = $page2->doEditContent(
-                       new WikitextContent( $text . '2' ),
-                       __METHOD__ . 'b',
-                       0,
-                       false,
-                       $this->getTestUser()->getUser()
-               )->value['revision'];
+               $rev2 = $editStatus->getValue()['revision'];
+
                $store = MediaWikiServices::getInstance()->getRevisionStore();
                $result = $store->newRevisionsFromBatch(
                        [ $this->revisionToRow( $rev1 ), $this->revisionToRow( $rev2 ) ],
@@ -2016,14 +2012,15 @@ abstract class RevisionStoreDbTestBase extends MediaWikiTestCase {
                );
                $this->assertTrue( $result->isGood() );
                $this->assertEmpty( $result->getErrors() );
+               /** @var RevisionRecord[] $records */
                $records = $result->getValue();
                $this->assertRevisionRecordMatchesRevision( $rev1, $records[$rev1->getId()] );
                $this->assertRevisionRecordMatchesRevision( $rev2, $records[$rev2->getId()] );
 
                $this->assertSame( $text . '1',
-                       $records[$rev1->getId()]->getContent( SlotRecord::MAIN )->serialize() );
+                       ContentHandler::getContentText( $records[$rev1->getId()]->getContent( SlotRecord::MAIN ) ) );
                $this->assertSame( $text . '2',
-                       $records[$rev2->getId()]->getContent( SlotRecord::MAIN )->serialize() );
+                       ContentHandler::getContentText( $records[$rev2->getId()]->getContent( SlotRecord::MAIN ) ) );
                $this->assertEquals( $page1->getTitle()->getDBkey(),
                        $records[$rev1->getId()]->getPageAsLinkTarget()->getDBkey() );
                $this->assertEquals( $page2->getTitle()->getDBkey(),
@@ -2046,4 +2043,41 @@ abstract class RevisionStoreDbTestBase extends MediaWikiTestCase {
                $this->assertEmpty( $result->getValue() );
                $this->assertEmpty( $result->getErrors() );
        }
+
+       /**
+        * @covers \MediaWiki\Revision\RevisionStore::newRevisionsFromBatch
+        */
+       public function testNewRevisionsFromBatch_wrongTitle() {
+               $page1 = $this->getTestPage();
+               $text = __METHOD__ . 'b-ä';
+               $editStatus = $this->editPage( $page1->getTitle()->getPrefixedDBkey(), $text . '1' );
+               $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 1' );
+               /** @var Revision $rev1 */
+               $rev1 = $editStatus->getValue()['revision'];
+
+               $this->setExpectedException( InvalidArgumentException::class );
+               MediaWikiServices::getInstance()->getRevisionStore()
+                       ->newRevisionsFromBatch(
+                               [ $this->revisionToRow( $rev1 ) ],
+                               [],
+                               IDBAccessObject::READ_NORMAL,
+                               $this->getTestPage( 'Title_Other_Then_The_One_Revision_Belongs_To' )->getTitle()
+                       );
+       }
+
+       /**
+        * @covers \MediaWiki\Revision\RevisionStore::newRevisionsFromBatch
+        */
+       public function testNewRevisionsFromBatch_DuplicateRows() {
+               $page1 = $this->getTestPage();
+               $text = __METHOD__ . 'b-ä';
+               $editStatus = $this->editPage( $page1->getTitle()->getPrefixedDBkey(), $text . '1' );
+               $this->assertTrue( $editStatus->isGood(), 'Sanity: must create revision 1' );
+               /** @var Revision $rev1 */
+               $rev1 = $editStatus->getValue()['revision'];
+
+               $this->setExpectedException( InvalidArgumentException::class );
+               MediaWikiServices::getInstance()->getRevisionStore()
+                       ->newRevisionsFromBatch( [ $this->revisionToRow( $rev1 ), $this->revisionToRow( $rev1 ) ] );
+       }
 }
index b0d89a6..ff9fa7b 100644 (file)
@@ -21,7 +21,7 @@ class SiteStatsTest extends MediaWikiTestCase {
                );
 
                $jobq->get( 'null' )->delete();  // clear jobqueue
-               $this->assertEquals( 0, $jobq->get( 'null' )->getSize(),
+               $this->assertSame( 0, $jobq->get( 'null' )->getSize(),
                        'Job queue for NullJob has been cleaned' );
 
                $cache->delete( $cache->makeKey( 'SiteStats', 'jobscount' ) );
@@ -29,7 +29,7 @@ class SiteStatsTest extends MediaWikiTestCase {
                        'jobs count is kept in process cache' );
 
                $cache->clearProcessCache();
-               $this->assertEquals( 0, SiteStats::jobs() );
+               $this->assertSame( 0, SiteStats::jobs() );
        }
 
 }
index 2148411..c64169f 100644 (file)
@@ -1062,7 +1062,7 @@ class DerivedPageDataUpdaterTest extends MediaWikiTestCase {
 
                $this->db->endAtomic( __METHOD__ ); // run deferred updates
 
-               $this->assertEquals( 0, DeferredUpdates::pendingUpdatesCount(), 'No pending updates' );
+               $this->assertSame( 0, DeferredUpdates::pendingUpdatesCount(), 'No pending updates' );
        }
 
        /**
@@ -1095,7 +1095,7 @@ class DerivedPageDataUpdaterTest extends MediaWikiTestCase {
 
                $this->db->endAtomic( __METHOD__ ); // run deferred updates
 
-               $this->assertEquals( 0, DeferredUpdates::pendingUpdatesCount(), 'No pending updates' );
+               $this->assertSame( 0, DeferredUpdates::pendingUpdatesCount(), 'No pending updates' );
                $this->assertNotFalse( $pcache->get( $page, $updater->getCanonicalParserOptions() ) );
        }
 
index 77d6f59..ec002e0 100644 (file)
@@ -327,7 +327,7 @@ class TitleMethodsTest extends MediaWikiLangTestCase {
 
                $title2 = Title::newFromText( 'Foo' );
                $this->assertNotSame( $title1, $title2, 'title cache should be empty' );
-               $this->assertEquals( 0, $linkCache->getGoodLinkID( 'Foo' ), 'link cache should be empty' );
+               $this->assertSame( 0, $linkCache->getGoodLinkID( 'Foo' ), 'link cache should be empty' );
        }
 
        public function provideGetLinkURL() {
index ab9abbb..f95505b 100644 (file)
@@ -46,7 +46,7 @@ class XmlTest extends MediaWikiTestCase {
                $this->assertNull( Xml::expandAttributes( null ),
                        'Converting a null list of attributes'
                );
-               $this->assertEquals( '', Xml::expandAttributes( [] ),
+               $this->assertSame( '', Xml::expandAttributes( [] ),
                        'Converting an empty list of attributes'
                );
        }
index fdc9c1b..b1b8a42 100644 (file)
@@ -214,7 +214,7 @@ class ApiPageSetTest extends ApiTestCase {
                        'titles' => 'User:' . implode( '|User:', $userNames ),
                ] );
 
-               $this->assertEquals( 0, $genderCache->misses,
+               $this->assertSame( 0, $genderCache->misses,
                        'ApiPageSet does not prefill the gender cache correctly' );
                $this->assertEquals( $userNames, array_keys( $genderCache->cache ),
                        'ApiPageSet does not prefill all users into the gender cache' );
index 2b08a81..26fedba 100644 (file)
@@ -1575,7 +1575,7 @@ class ApiQueryWatchlistIntegrationTest extends ApiTestCase {
                $pages = array_values( $result[0]['query']['pages'] );
 
                $this->assertCount( 1, $pages );
-               $this->assertEquals( 0, $pages[0]['ns'] );
+               $this->assertSame( 0, $pages[0]['ns'] );
                $this->assertEquals( $this->getPrefixedText( $target ), $pages[0]['title'] );
                $this->assertArraySubsetsEqual(
                        $pages[0]['revisions'],
index c554fb3..b41c3e5 100644 (file)
@@ -535,7 +535,7 @@ class ApiQueryWatchlistRawIntegrationTest extends ApiTestCase {
                // $result[0]['query']['pages'] uses page ids as keys
                $item = array_values( $result[0]['query']['pages'] )[0];
 
-               $this->assertEquals( 0, $item['ns'] );
+               $this->assertSame( 0, $item['ns'] );
                $this->assertEquals( 'ApiQueryWatchlistRawIntegrationTestPage', $item['title'] );
        }
 
index 6d64a17..24d016e 100644 (file)
@@ -64,7 +64,7 @@ class ApiWatchTest extends ApiTestCase {
                                unset( $data[0]['query']['watchlist'][$index] );
                        }
                }
-               $this->assertEquals( 0, count( $data[0]['query']['watchlist'] ) );
+               $this->assertSame( 0, count( $data[0]['query']['watchlist'] ) );
 
                return $data;
        }
index f8be1d4..55d4e10 100644 (file)
@@ -2120,9 +2120,9 @@ class AuthManagerTest extends \MediaWikiTestCase {
                        }
 
                        if ( $created ) {
-                               $this->assertNotEquals( 0, \User::idFromName( $username ) );
+                               $this->assertNotNull( \User::idFromName( $username ) );
                        } else {
-                               $this->assertEquals( 0, \User::idFromName( $username ) );
+                               $this->assertNull( \User::idFromName( $username ) );
                        }
 
                        $first = false;
@@ -2474,7 +2474,7 @@ class AuthManagerTest extends \MediaWikiTestCase {
                $this->assertEquals( $expect, $ret );
                $this->assertNotEquals( 0, $user->getId() );
                $this->assertSame( 'UTSysop', $user->getName() );
-               $this->assertEquals( 0, $session->getUser()->getId() );
+               $this->assertSame( 0, $session->getUser()->getId() );
                $this->assertSame( [
                        [ LogLevel::DEBUG, '{username} already exists locally' ],
                ], $logger->getBuffer() );
@@ -2489,9 +2489,9 @@ class AuthManagerTest extends \MediaWikiTestCase {
                $ret = $this->manager->autoCreateUser( $user, AuthManager::AUTOCREATE_SOURCE_SESSION, true );
                $this->unhook( 'LocalUserCreated' );
                $this->assertEquals( \Status::newFatal( wfMessage( 'readonlytext', 'Because' ) ), $ret );
-               $this->assertEquals( 0, $user->getId() );
+               $this->assertSame( 0, $user->getId() );
                $this->assertNotEquals( $username, $user->getName() );
-               $this->assertEquals( 0, $session->getUser()->getId() );
+               $this->assertSame( 0, $session->getUser()->getId() );
                $this->assertSame( [
                        [ LogLevel::DEBUG, 'denied by wfReadOnly(): {reason}' ],
                ], $logger->getBuffer() );
@@ -2506,9 +2506,9 @@ class AuthManagerTest extends \MediaWikiTestCase {
                $ret = $this->manager->autoCreateUser( $user, AuthManager::AUTOCREATE_SOURCE_SESSION, true );
                $this->unhook( 'LocalUserCreated' );
                $this->assertEquals( \Status::newFatal( 'test' ), $ret );
-               $this->assertEquals( 0, $user->getId() );
+               $this->assertSame( 0, $user->getId() );
                $this->assertNotEquals( $username, $user->getName() );
-               $this->assertEquals( 0, $session->getUser()->getId() );
+               $this->assertSame( 0, $session->getUser()->getId() );
                $this->assertSame( [
                        [ LogLevel::DEBUG, 'blacklisted in session {sessionid}' ],
                ], $logger->getBuffer() );
@@ -2521,9 +2521,9 @@ class AuthManagerTest extends \MediaWikiTestCase {
                $ret = $this->manager->autoCreateUser( $user, AuthManager::AUTOCREATE_SOURCE_SESSION, true );
                $this->unhook( 'LocalUserCreated' );
                $this->assertEquals( \Status::newFatal( 'test2' ), $ret );
-               $this->assertEquals( 0, $user->getId() );
+               $this->assertSame( 0, $user->getId() );
                $this->assertNotEquals( $username, $user->getName() );
-               $this->assertEquals( 0, $session->getUser()->getId() );
+               $this->assertSame( 0, $session->getUser()->getId() );
                $this->assertSame( [
                        [ LogLevel::DEBUG, 'blacklisted in session {sessionid}' ],
                ], $logger->getBuffer() );
@@ -2536,9 +2536,9 @@ class AuthManagerTest extends \MediaWikiTestCase {
                $ret = $this->manager->autoCreateUser( $user, AuthManager::AUTOCREATE_SOURCE_SESSION, true );
                $this->unhook( 'LocalUserCreated' );
                $this->assertEquals( \Status::newFatal( 'noname' ), $ret );
-               $this->assertEquals( 0, $user->getId() );
+               $this->assertSame( 0, $user->getId() );
                $this->assertNotEquals( $username . '@', $user->getId() );
-               $this->assertEquals( 0, $session->getUser()->getId() );
+               $this->assertSame( 0, $session->getUser()->getId() );
                $this->assertSame( [
                        [ LogLevel::DEBUG, 'name "{username}" is not creatable' ],
                ], $logger->getBuffer() );
@@ -2554,9 +2554,9 @@ class AuthManagerTest extends \MediaWikiTestCase {
                $ret = $this->manager->autoCreateUser( $user, AuthManager::AUTOCREATE_SOURCE_SESSION, true );
                $this->unhook( 'LocalUserCreated' );
                $this->assertEquals( \Status::newFatal( 'authmanager-autocreate-noperm' ), $ret );
-               $this->assertEquals( 0, $user->getId() );
+               $this->assertSame( 0, $user->getId() );
                $this->assertNotEquals( $username, $user->getName() );
-               $this->assertEquals( 0, $session->getUser()->getId() );
+               $this->assertSame( 0, $session->getUser()->getId() );
                $this->assertSame( [
                        [ LogLevel::DEBUG, 'IP lacks the ability to create or autocreate accounts' ],
                ], $logger->getBuffer() );
@@ -2608,9 +2608,9 @@ class AuthManagerTest extends \MediaWikiTestCase {
                unset( $lock );
                $this->unhook( 'LocalUserCreated' );
                $this->assertEquals( \Status::newFatal( 'usernameinprogress' ), $ret );
-               $this->assertEquals( 0, $user->getId() );
+               $this->assertSame( 0, $user->getId() );
                $this->assertNotEquals( $username, $user->getName() );
-               $this->assertEquals( 0, $session->getUser()->getId() );
+               $this->assertSame( 0, $session->getUser()->getId() );
                $this->assertSame( [
                        [ LogLevel::DEBUG, 'Could not acquire account creation lock' ],
                ], $logger->getBuffer() );
@@ -2623,9 +2623,9 @@ class AuthManagerTest extends \MediaWikiTestCase {
                $ret = $this->manager->autoCreateUser( $user, AuthManager::AUTOCREATE_SOURCE_SESSION, true );
                $this->unhook( 'LocalUserCreated' );
                $this->assertEquals( \Status::newFatal( 'fail-in-pre' ), $ret );
-               $this->assertEquals( 0, $user->getId() );
+               $this->assertSame( 0, $user->getId() );
                $this->assertNotEquals( $username, $user->getName() );
-               $this->assertEquals( 0, $session->getUser()->getId() );
+               $this->assertSame( 0, $session->getUser()->getId() );
                $this->assertSame( [
                        [ LogLevel::DEBUG, 'Provider denied creation of {username}: {reason}' ],
                ], $logger->getBuffer() );
@@ -2640,9 +2640,9 @@ class AuthManagerTest extends \MediaWikiTestCase {
                $ret = $this->manager->autoCreateUser( $user, AuthManager::AUTOCREATE_SOURCE_SESSION, true );
                $this->unhook( 'LocalUserCreated' );
                $this->assertEquals( \Status::newFatal( 'fail-in-primary' ), $ret );
-               $this->assertEquals( 0, $user->getId() );
+               $this->assertSame( 0, $user->getId() );
                $this->assertNotEquals( $username, $user->getName() );
-               $this->assertEquals( 0, $session->getUser()->getId() );
+               $this->assertSame( 0, $session->getUser()->getId() );
                $this->assertSame( [
                        [ LogLevel::DEBUG, 'Provider denied creation of {username}: {reason}' ],
                ], $logger->getBuffer() );
@@ -2657,9 +2657,9 @@ class AuthManagerTest extends \MediaWikiTestCase {
                $ret = $this->manager->autoCreateUser( $user, AuthManager::AUTOCREATE_SOURCE_SESSION, true );
                $this->unhook( 'LocalUserCreated' );
                $this->assertEquals( \Status::newFatal( 'fail-in-secondary' ), $ret );
-               $this->assertEquals( 0, $user->getId() );
+               $this->assertSame( 0, $user->getId() );
                $this->assertNotEquals( $username, $user->getName() );
-               $this->assertEquals( 0, $session->getUser()->getId() );
+               $this->assertSame( 0, $session->getUser()->getId() );
                $this->assertSame( [
                        [ LogLevel::DEBUG, 'Provider denied creation of {username}: {reason}' ],
                ], $logger->getBuffer() );
@@ -2678,9 +2678,9 @@ class AuthManagerTest extends \MediaWikiTestCase {
                $ret = $this->manager->autoCreateUser( $user, AuthManager::AUTOCREATE_SOURCE_SESSION, true );
                $this->unhook( 'LocalUserCreated' );
                $this->assertEquals( \Status::newFatal( 'authmanager-autocreate-exception' ), $ret );
-               $this->assertEquals( 0, $user->getId() );
+               $this->assertSame( 0, $user->getId() );
                $this->assertNotEquals( $username, $user->getName() );
-               $this->assertEquals( 0, $session->getUser()->getId() );
+               $this->assertSame( 0, $session->getUser()->getId() );
                $this->assertSame( [
                        [ LogLevel::DEBUG, '{username} denied by prior creation attempt failures' ],
                ], $logger->getBuffer() );
@@ -2697,9 +2697,9 @@ class AuthManagerTest extends \MediaWikiTestCase {
                $user->setName( $username );
                $ret = $this->manager->autoCreateUser( $user, AuthManager::AUTOCREATE_SOURCE_SESSION, true );
                $this->assertEquals( \Status::newFatal( 'because' ), $ret );
-               $this->assertEquals( 0, $user->getId() );
+               $this->assertSame( 0, $user->getId() );
                $this->assertNotEquals( $username, $user->getName() );
-               $this->assertEquals( 0, $session->getUser()->getId() );
+               $this->assertSame( 0, $session->getUser()->getId() );
                $this->assertSame( [
                        [ LogLevel::INFO, 'creating new user ({username}) - from: {from}' ],
                        [ LogLevel::ERROR, '{username} failed with message {msg}' ],
@@ -2723,8 +2723,8 @@ class AuthManagerTest extends \MediaWikiTestCase {
                } catch ( \Exception $ex ) {
                        $this->assertSame( 'Excepted', $ex->getMessage() );
                }
-               $this->assertEquals( 0, $user->getId() );
-               $this->assertEquals( 0, $session->getUser()->getId() );
+               $this->assertSame( 0, $user->getId() );
+               $this->assertSame( 0, $session->getUser()->getId() );
                $this->assertSame( [
                        [ LogLevel::INFO, 'creating new user ({username}) - from: {from}' ],
                        [ LogLevel::ERROR, '{username} failed with exception {exception}' ],
@@ -2790,7 +2790,7 @@ class AuthManagerTest extends \MediaWikiTestCase {
                $this->assertEquals( \Status::newGood(), $ret );
                $this->assertNotEquals( 0, $user->getId() );
                $this->assertEquals( $username, $user->getName() );
-               $this->assertEquals( 0, $session->getUser()->getId() );
+               $this->assertSame( 0, $session->getUser()->getId() );
                $this->assertSame( [
                        [ LogLevel::INFO, 'creating new user ({username}) - from: {from}' ],
                ], $logger->getBuffer() );
index ebbfde2..b1e23ba 100644 (file)
@@ -282,7 +282,7 @@ class BlockRestrictionStoreTest extends \MediaWikiLangTestCase {
                        [ 'ir_ipb_id' => $block->getId() ]
                );
 
-               $this->assertEquals( 0, $result->numRows() );
+               $this->assertSame( 0, $result->numRows() );
        }
 
        /**
index 0ef571d..9182609 100644 (file)
@@ -314,7 +314,7 @@ class DatabaseBlockTest extends MediaWikiLangTestCase {
                $this->assertEquals( 'Meta>MetaWikiUser', $block->getBlocker()->getName(),
                        'Correct blocker name' );
                $this->assertEquals( 'Meta>MetaWikiUser', $block->getByName(), 'Correct blocker name' );
-               $this->assertEquals( 0, $block->getBy(), 'Correct blocker id' );
+               $this->assertSame( 0, $block->getBy(), 'Correct blocker id' );
        }
 
        protected function addXffBlocks() {
index 7abddd4..869236b 100644 (file)
@@ -124,7 +124,7 @@ class MessageCacheTest extends MediaWikiLangTestCase {
                $this->makePage( 'Go', 'de', 'Race!' );
                $dbw->endAtomic( __METHOD__ );
 
-               $this->assertEquals( 0,
+               $this->assertSame( 0,
                        DeferredUpdates::pendingUpdatesCount(),
                        'Post-commit deferred update triggers a run of all updates' );
 
@@ -155,7 +155,7 @@ class MessageCacheTest extends MediaWikiLangTestCase {
 
                // Populate one key
                $this->makePage( 'Key1', 'de', 'Value1' );
-               $this->assertEquals( 0,
+               $this->assertSame( 0,
                        DeferredUpdates::pendingUpdatesCount(),
                        'Post-commit deferred update triggers a run of all updates' );
                $this->assertEquals( 'Value1', $messageCache->get( 'Key1' ), 'Key1 was successfully edited' );
@@ -168,7 +168,7 @@ class MessageCacheTest extends MediaWikiLangTestCase {
 
                // Populate the second key
                $this->makePage( 'Key2', 'de', 'Value2' );
-               $this->assertEquals( 0,
+               $this->assertSame( 0,
                        DeferredUpdates::pendingUpdatesCount(),
                        'Post-commit deferred update triggers a run of all updates' );
                $this->assertEquals( 'Value2', $messageCache->get( 'Key2' ), 'Key2 was successfully edited' );
@@ -208,14 +208,14 @@ class MessageCacheTest extends MediaWikiLangTestCase {
 
                MessageCache::singleton()->getMsgFromNamespace( 'allpages', $wgContLanguageCode );
 
-               $this->assertEquals( 0, $dbr->trxLevel() );
+               $this->assertSame( 0, $dbr->trxLevel() );
                $dbr->setFlag( DBO_TRX, $dbr::REMEMBER_PRIOR ); // make queries trigger TRX
 
                MessageCache::singleton()->getMsgFromNamespace( 'go', $wgContLanguageCode );
 
                $dbr->restoreFlags();
 
-               $this->assertEquals( 0, $dbr->trxLevel(), "No DB read queries (content language)" );
+               $this->assertSame( 0, $dbr->trxLevel(), "No DB read queries (content language)" );
        }
 
        public function testNoDBAccessNonContentLanguage() {
@@ -223,14 +223,14 @@ class MessageCacheTest extends MediaWikiLangTestCase {
 
                MessageCache::singleton()->getMsgFromNamespace( 'allpages/nl', 'nl' );
 
-               $this->assertEquals( 0, $dbr->trxLevel() );
+               $this->assertSame( 0, $dbr->trxLevel() );
                $dbr->setFlag( DBO_TRX, $dbr::REMEMBER_PRIOR ); // make queries trigger TRX
 
                MessageCache::singleton()->getMsgFromNamespace( 'go/nl', 'nl' );
 
                $dbr->restoreFlags();
 
-               $this->assertEquals( 0, $dbr->trxLevel(), "No DB read queries (non-content language)" );
+               $this->assertSame( 0, $dbr->trxLevel(), "No DB read queries (non-content language)" );
        }
 
        /**
index 7ad6541..31929d3 100644 (file)
@@ -83,12 +83,12 @@ class CategoryMembershipChangeTest extends MediaWikiLangTestCase {
                $this->assertEquals( '(recentchanges-page-added-to-category: ' . self::$pageName . ')',
                        self::$lastNotifyArgs[3] );
                $this->assertEquals( self::$pageName, self::$lastNotifyArgs[4]->getPrefixedText() );
-               $this->assertEquals( 0, self::$lastNotifyArgs[5] );
-               $this->assertEquals( 0, self::$lastNotifyArgs[6] );
+               $this->assertSame( 0, self::$lastNotifyArgs[5] );
+               $this->assertSame( 0, self::$lastNotifyArgs[6] );
                $this->assertEquals( null, self::$lastNotifyArgs[7] );
                $this->assertEquals( 1, self::$lastNotifyArgs[8] );
                $this->assertEquals( null, self::$lastNotifyArgs[9] );
-               $this->assertEquals( 0, self::$lastNotifyArgs[10] );
+               $this->assertSame( 0, self::$lastNotifyArgs[10] );
        }
 
        public function testChangeRemovedNoRev() {
@@ -103,12 +103,12 @@ class CategoryMembershipChangeTest extends MediaWikiLangTestCase {
                $this->assertEquals( '(recentchanges-page-removed-from-category: ' . self::$pageName . ')',
                        self::$lastNotifyArgs[3] );
                $this->assertEquals( self::$pageName, self::$lastNotifyArgs[4]->getPrefixedText() );
-               $this->assertEquals( 0, self::$lastNotifyArgs[5] );
-               $this->assertEquals( 0, self::$lastNotifyArgs[6] );
+               $this->assertSame( 0, self::$lastNotifyArgs[5] );
+               $this->assertSame( 0, self::$lastNotifyArgs[6] );
                $this->assertEquals( null, self::$lastNotifyArgs[7] );
                $this->assertEquals( 1, self::$lastNotifyArgs[8] );
                $this->assertEquals( null, self::$lastNotifyArgs[9] );
-               $this->assertEquals( 0, self::$lastNotifyArgs[10] );
+               $this->assertSame( 0, self::$lastNotifyArgs[10] );
        }
 
        public function testChangeAddedWithRev() {
@@ -127,9 +127,9 @@ class CategoryMembershipChangeTest extends MediaWikiLangTestCase {
                $this->assertEquals( self::$pageRev->getParentId(), self::$lastNotifyArgs[5] );
                $this->assertEquals( $revision->getId(), self::$lastNotifyArgs[6] );
                $this->assertEquals( null, self::$lastNotifyArgs[7] );
-               $this->assertEquals( 0, self::$lastNotifyArgs[8] );
+               $this->assertSame( 0, self::$lastNotifyArgs[8] );
                $this->assertEquals( '127.0.0.1', self::$lastNotifyArgs[9] );
-               $this->assertEquals( 0, self::$lastNotifyArgs[10] );
+               $this->assertSame( 0, self::$lastNotifyArgs[10] );
        }
 
        public function testChangeRemovedWithRev() {
@@ -148,9 +148,9 @@ class CategoryMembershipChangeTest extends MediaWikiLangTestCase {
                $this->assertEquals( self::$pageRev->getParentId(), self::$lastNotifyArgs[5] );
                $this->assertEquals( $revision->getId(), self::$lastNotifyArgs[6] );
                $this->assertEquals( null, self::$lastNotifyArgs[7] );
-               $this->assertEquals( 0, self::$lastNotifyArgs[8] );
+               $this->assertSame( 0, self::$lastNotifyArgs[8] );
                $this->assertEquals( '127.0.0.1', self::$lastNotifyArgs[9] );
-               $this->assertEquals( 0, self::$lastNotifyArgs[10] );
+               $this->assertSame( 0, self::$lastNotifyArgs[10] );
        }
 
 }
index 1511d46..895a3cb 100644 (file)
@@ -76,7 +76,7 @@ class EnhancedChangesListTest extends MediaWikiLangTestCase {
                $recentChange2 = $this->getEditChange( '20131103092253' );
                $html = $enhancedChangesList->recentChangesLine( $recentChange2, false );
 
-               $this->assertEquals( '', $html );
+               $this->assertSame( '', $html );
        }
 
        public function testRecentChangesPrefix() {
index 8f914b7..a59ba7d 100644 (file)
@@ -61,7 +61,7 @@ class RCCacheEntryFactoryTest extends MediaWikiLangTestCase {
 
                $this->assertEquals( false, $cacheEntry->watched, 'watched' );
                $this->assertEquals( '21:21', $cacheEntry->timestamp, 'timestamp' );
-               $this->assertEquals( 0, $cacheEntry->numberofWatchingusers, 'watching users' );
+               $this->assertSame( 0, $cacheEntry->numberofWatchingusers, 'watching users' );
                $this->assertEquals( false, $cacheEntry->unpatrolled, 'unpatrolled' );
 
                $this->assertUserLinks( $user->getName(), $cacheEntry );
@@ -96,7 +96,7 @@ class RCCacheEntryFactoryTest extends MediaWikiLangTestCase {
 
                $this->assertEquals( false, $cacheEntry->watched, 'watched' );
                $this->assertEquals( '21:21', $cacheEntry->timestamp, 'timestamp' );
-               $this->assertEquals( 0, $cacheEntry->numberofWatchingusers, 'watching users' );
+               $this->assertSame( 0, $cacheEntry->numberofWatchingusers, 'watching users' );
                $this->assertEquals( false, $cacheEntry->unpatrolled, 'unpatrolled' );
 
                $this->assertDeleteLogLink( $cacheEntry );
@@ -130,7 +130,7 @@ class RCCacheEntryFactoryTest extends MediaWikiLangTestCase {
 
                $this->assertEquals( false, $cacheEntry->watched, 'watched' );
                $this->assertEquals( '21:21', $cacheEntry->timestamp, 'timestamp' );
-               $this->assertEquals( 0, $cacheEntry->numberofWatchingusers, 'watching users' );
+               $this->assertSame( 0, $cacheEntry->numberofWatchingusers, 'watching users' );
                $this->assertEquals( false, $cacheEntry->unpatrolled, 'unpatrolled' );
 
                $this->assertRevDel( $cacheEntry );
index e73b554..39b5380 100644 (file)
@@ -181,7 +181,7 @@ class ContentHandlerTest extends MediaWikiTestCase {
                $content = null;
 
                $text = ContentHandler::getContentText( $content );
-               $this->assertEquals( '', $text );
+               $this->assertSame( '', $text );
        }
 
        public static function dataGetContentText_TextContent() {
index bc1d3c6..0572289 100644 (file)
@@ -49,7 +49,7 @@ class UnknownContentHandlerTest extends MediaWikiLangTestCase {
                $content = $handler->makeEmptyContent();
 
                $this->assertTrue( $content->isEmpty() );
-               $this->assertEquals( '', $content->getData() );
+               $this->assertSame( '', $content->getData() );
        }
 
        public static function dataIsSupportedFormat() {
index fd8e3ba..2b6f3f1 100644 (file)
@@ -139,7 +139,7 @@ class UnknownContentTest extends MediaWikiLangTestCase {
        public function testGetWikitextForTransclusion() {
                $content = $this->newContent( 'hello world.' );
 
-               $this->assertEquals( '', $content->getWikitextForTransclusion() );
+               $this->assertFalse( $content->getWikitextForTransclusion() );
        }
 
        /**
index b372e37..e18cecb 100644 (file)
@@ -64,7 +64,7 @@ class WikitextContentHandlerTest extends MediaWikiLangTestCase {
                $content = $this->handler->makeEmptyContent();
 
                $this->assertTrue( $content->isEmpty() );
-               $this->assertEquals( '', $content->getText() );
+               $this->assertSame( '', $content->getText() );
        }
 
        public static function dataIsSupportedFormat() {
index 32e71e0..3bb79e4 100644 (file)
@@ -49,7 +49,7 @@ class RequestContextTest extends MediaWikiTestCase {
 
                $oInfo = $context->exportSession();
                $this->assertEquals( '127.0.0.1', $oInfo['ip'], "Correct initial IP address." );
-               $this->assertEquals( 0, $oInfo['userId'], "Correct initial user ID." );
+               $this->assertSame( 0, $oInfo['userId'], "Correct initial user ID." );
                $this->assertFalse( MediaWiki\Session\SessionManager::getGlobalSession()->isPersistent(),
                        'Global session isn\'t persistent to start' );
 
index c789e83..f00499f 100644 (file)
@@ -187,7 +187,7 @@ class LBFactoryTest extends MediaWikiTestCase {
                };
 
                $factory = $this->newLBFactoryMultiLBs();
-               $this->assertEquals( 0, $countLBsFunc( $factory ) );
+               $this->assertSame( 0, $countLBsFunc( $factory ) );
                $dbw = $factory->getMainLB()->getConnection( DB_MASTER );
                $this->assertEquals( 1, $countLBsFunc( $factory ) );
                // Test that LoadBalancer instances made during pre-commit callbacks in do not
@@ -208,7 +208,7 @@ class LBFactoryTest extends MediaWikiTestCase {
 
                $called = 0;
                $factory = $this->newLBFactoryMultiLBs();
-               $this->assertEquals( 0, $countLBsFunc( $factory ) );
+               $this->assertSame( 0, $countLBsFunc( $factory ) );
                $dbw = $factory->getMainLB()->getConnection( DB_MASTER );
                $this->assertEquals( 1, $countLBsFunc( $factory ) );
                // Test that LoadBalancer instances made during pre-commit callbacks in do not
@@ -475,17 +475,16 @@ class LBFactoryTest extends MediaWikiTestCase {
                /** @var IMaintainableDatabase $db */
                $db = $lb->getConnection( DB_MASTER, [], '' );
 
-               $this->assertEquals(
+               $this->assertSame(
                        '',
                        $db->getDomainId(),
                        'Null domain ID handle used'
                );
-               $this->assertEquals(
-                       '',
+               $this->assertNull(
                        $db->getDBname(),
                        'Null domain ID handle used'
                );
-               $this->assertEquals(
+               $this->assertSame(
                        '',
                        $db->tablePrefix(),
                        'Main domain ID handle used; prefix is empty though'
@@ -555,7 +554,7 @@ class LBFactoryTest extends MediaWikiTestCase {
                /** @var IMaintainableDatabase $db */
                $db = $lb->getConnection( DB_MASTER, [], '' );
 
-               $this->assertEquals( '', $db->getDomainID(), "Null domain used" );
+               $this->assertSame( '', $db->getDomainID(), "Null domain used" );
 
                $this->assertEquals(
                        $this->quoteTable( $db, 'page' ),
@@ -717,7 +716,7 @@ class LBFactoryTest extends MediaWikiTestCase {
                $lb->forEachOpenConnection( function () use ( &$n ) {
                        ++$n;
                } );
-               $this->assertEquals( 0, $n, "Connections closed" );
+               $this->assertSame( 0, $n, "Connections closed" );
 
                $conn2 = $lb->getConnectionRef( DB_MASTER );
                $this->assertEquals(
index ccfcc18..f820f60 100644 (file)
@@ -20,8 +20,8 @@ class SiteStatsUpdateTest extends MediaWikiTestCase {
                $this->assertEquals( 1, $wrapped->pages );
                $this->assertEquals( 3, $wrapped->users );
                $this->assertEquals( 1, $wrapped->images );
-               $this->assertEquals( 0, $wrapped->edits );
-               $this->assertEquals( 0, $wrapped->articles );
+               $this->assertSame( 0, $wrapped->edits );
+               $this->assertSame( 0, $wrapped->articles );
        }
 
        /**
@@ -42,7 +42,7 @@ class SiteStatsUpdateTest extends MediaWikiTestCase {
                $fi = SiteStats::images();
                $ai = SiteStats::articles();
 
-               $this->assertEquals( 0, DeferredUpdates::pendingUpdatesCount() );
+               $this->assertSame( 0, DeferredUpdates::pendingUpdatesCount() );
 
                $dbw->begin( __METHOD__ ); // block opportunistic updates
 
@@ -64,7 +64,7 @@ class SiteStatsUpdateTest extends MediaWikiTestCase {
 
                $this->assertEquals( 1, DeferredUpdates::pendingUpdatesCount() );
                DeferredUpdates::doUpdates();
-               $this->assertEquals( 0, DeferredUpdates::pendingUpdatesCount() );
+               $this->assertSame( 0, DeferredUpdates::pendingUpdatesCount() );
 
                SiteStats::unload();
                $this->assertEquals( $pi + 2, SiteStats::pages(), 'page count' );
index e344d57..7bc7918 100644 (file)
@@ -2554,7 +2554,7 @@ class FileBackendTest extends MediaWikiTestCase {
                        $be->getReadIndexFromParams( [ 'latest' => 1 ] ),
                        'Reads with "latest" flag use backend 1'
                );
-               $this->assertEquals(
+               $this->assertSame(
                        0,
                        $be->getReadIndexFromParams( [ 'latest' => 0 ] ),
                        'Reads without "latest" flag use backend 0'
index 8f37805..fe5dba1 100644 (file)
@@ -52,7 +52,7 @@ class LocalFileTest extends MediaWikiTestCase {
         * @covers File::getHashPath
         */
        public function testGetHashPath() {
-               $this->assertEquals( '', $this->file_hl0->getHashPath() );
+               $this->assertSame( '', $this->file_hl0->getHashPath() );
                $this->assertEquals( 'a/a2/', $this->file_hl2->getHashPath() );
                $this->assertEquals( 'c/c4/', $this->file_lc->getHashPath() );
        }
index c9356b6..ff0a9eb 100644 (file)
@@ -109,7 +109,7 @@ class GuzzleHttpRequestTest extends MediaWikiTestCase {
                $s = $r->execute();
                $errorMsg = $s->getErrorsByType( 'error' )[0]['message'];
 
-               $this->assertEquals( 0, $r->getStatus() );
+               $this->assertSame( 0, $r->getStatus() );
                $this->assertEquals( 'http-invalid-url', $errorMsg );
        }
 
@@ -121,7 +121,7 @@ class GuzzleHttpRequestTest extends MediaWikiTestCase {
                $s = $r->execute();
                $errorMsg = $s->getErrorsByType( 'error' )[0]['message'];
 
-               $this->assertEquals( 0, $r->getStatus() );
+               $this->assertSame( 0, $r->getStatus() );
                $this->assertEquals( 'http-request-error', $errorMsg );
        }
 
@@ -133,7 +133,7 @@ class GuzzleHttpRequestTest extends MediaWikiTestCase {
                $s = $r->execute();
                $errorMsg = $s->getErrorsByType( 'error' )[0]['message'];
 
-               $this->assertEquals( 0, $r->getStatus() );
+               $this->assertSame( 0, $r->getStatus() );
                $this->assertEquals( 'http-timed-out', $errorMsg );
        }
 
index ef499a1..94b8c91 100644 (file)
@@ -14,7 +14,7 @@ class HttpTest extends MediaWikiTestCase {
                $this->hideDeprecated( 'Http::getProxy' );
 
                $this->setMwGlobals( 'wgHTTPProxy', false );
-               $this->assertEquals(
+               $this->assertSame(
                        '',
                        Http::getProxy(),
                        'default setting'
index 8f8dde5..1db7085 100644 (file)
@@ -108,8 +108,8 @@ class JobQueueTest extends MediaWikiTestCase {
                $this->assertTrue( $queue->isEmpty(), "Queue is empty ($desc)" );
 
                $queue->flushCaches();
-               $this->assertEquals( 0, $queue->getSize(), "Queue is empty ($desc)" );
-               $this->assertEquals( 0, $queue->getAcquiredCount(), "Queue is empty ($desc)" );
+               $this->assertSame( 0, $queue->getSize(), "Queue is empty ($desc)" );
+               $this->assertSame( 0, $queue->getAcquiredCount(), "Queue is empty ($desc)" );
 
                $this->assertNull( $queue->push( $this->newJob() ), "Push worked ($desc)" );
                $this->assertNull( $queue->batchPush( [ $this->newJob() ] ), "Push worked ($desc)" );
@@ -118,7 +118,7 @@ class JobQueueTest extends MediaWikiTestCase {
 
                $queue->flushCaches();
                $this->assertEquals( 2, $queue->getSize(), "Queue size is correct ($desc)" );
-               $this->assertEquals( 0, $queue->getAcquiredCount(), "No jobs active ($desc)" );
+               $this->assertSame( 0, $queue->getAcquiredCount(), "No jobs active ($desc)" );
                $jobs = iterator_to_array( $queue->getAllQueuedJobs() );
                $this->assertEquals( 2, count( $jobs ), "Queue iterator size is correct ($desc)" );
 
@@ -135,7 +135,7 @@ class JobQueueTest extends MediaWikiTestCase {
 
                $job2 = $queue->pop();
                $this->assertTrue( $queue->isEmpty(), "Queue is empty ($desc)" );
-               $this->assertEquals( 0, $queue->getSize(), "Queue is empty ($desc)" );
+               $this->assertSame( 0, $queue->getSize(), "Queue is empty ($desc)" );
 
                $queue->flushCaches();
                if ( $recycles ) {
@@ -152,7 +152,7 @@ class JobQueueTest extends MediaWikiTestCase {
                $queue->ack( $job2 );
 
                $queue->flushCaches();
-               $this->assertEquals( 0, $queue->getAcquiredCount(), "Active job count ($desc)" );
+               $this->assertSame( 0, $queue->getAcquiredCount(), "Active job count ($desc)" );
 
                $this->assertNull( $queue->batchPush( [ $this->newJob(), $this->newJob() ] ),
                        "Push worked ($desc)" );
@@ -161,7 +161,7 @@ class JobQueueTest extends MediaWikiTestCase {
                $queue->delete();
                $queue->flushCaches();
                $this->assertTrue( $queue->isEmpty(), "Queue is empty ($desc)" );
-               $this->assertEquals( 0, $queue->getSize(), "Queue is empty ($desc)" );
+               $this->assertSame( 0, $queue->getSize(), "Queue is empty ($desc)" );
        }
 
        /**
@@ -177,8 +177,8 @@ class JobQueueTest extends MediaWikiTestCase {
                $this->assertTrue( $queue->isEmpty(), "Queue is empty ($desc)" );
 
                $queue->flushCaches();
-               $this->assertEquals( 0, $queue->getSize(), "Queue is empty ($desc)" );
-               $this->assertEquals( 0, $queue->getAcquiredCount(), "Queue is empty ($desc)" );
+               $this->assertSame( 0, $queue->getSize(), "Queue is empty ($desc)" );
+               $this->assertSame( 0, $queue->getAcquiredCount(), "Queue is empty ($desc)" );
 
                $this->assertNull(
                        $queue->batchPush(
@@ -190,7 +190,7 @@ class JobQueueTest extends MediaWikiTestCase {
 
                $queue->flushCaches();
                $this->assertEquals( 1, $queue->getSize(), "Queue size is correct ($desc)" );
-               $this->assertEquals( 0, $queue->getAcquiredCount(), "No jobs active ($desc)" );
+               $this->assertSame( 0, $queue->getAcquiredCount(), "No jobs active ($desc)" );
 
                $this->assertNull(
                        $queue->batchPush(
@@ -203,13 +203,13 @@ class JobQueueTest extends MediaWikiTestCase {
 
                $queue->flushCaches();
                $this->assertEquals( 1, $queue->getSize(), "Queue size is correct ($desc)" );
-               $this->assertEquals( 0, $queue->getAcquiredCount(), "No jobs active ($desc)" );
+               $this->assertSame( 0, $queue->getAcquiredCount(), "No jobs active ($desc)" );
 
                $job1 = $queue->pop();
                $this->assertTrue( $queue->isEmpty(), "Queue is empty ($desc)" );
 
                $queue->flushCaches();
-               $this->assertEquals( 0, $queue->getSize(), "Queue is empty ($desc)" );
+               $this->assertSame( 0, $queue->getSize(), "Queue is empty ($desc)" );
                if ( $recycles ) {
                        $this->assertEquals( 1, $queue->getAcquiredCount(), "Active job count ($desc)" );
                }
@@ -217,7 +217,7 @@ class JobQueueTest extends MediaWikiTestCase {
                $queue->ack( $job1 );
 
                $queue->flushCaches();
-               $this->assertEquals( 0, $queue->getAcquiredCount(), "Active job count ($desc)" );
+               $this->assertSame( 0, $queue->getAcquiredCount(), "Active job count ($desc)" );
        }
 
        /**
@@ -256,8 +256,8 @@ class JobQueueTest extends MediaWikiTestCase {
                $this->assertTrue( $queue->isEmpty(), "Queue is empty ($desc)" );
 
                $queue->flushCaches();
-               $this->assertEquals( 0, $queue->getSize(), "Queue is empty ($desc)" );
-               $this->assertEquals( 0, $queue->getAcquiredCount(), "Queue is empty ($desc)" );
+               $this->assertSame( 0, $queue->getSize(), "Queue is empty ($desc)" );
+               $this->assertSame( 0, $queue->getAcquiredCount(), "Queue is empty ($desc)" );
 
                $root1 = Job::newRootJobParams( "nulljobspam:testId" ); // task ID/timestamp
                for ( $i = 0; $i < 5; ++$i ) {
@@ -282,7 +282,7 @@ class JobQueueTest extends MediaWikiTestCase {
 
                $queue->flushCaches();
                $this->assertEquals( 10, $queue->getSize(), "Queue size is correct ($desc)" );
-               $this->assertEquals( 0, $queue->getAcquiredCount(), "No jobs active ($desc)" );
+               $this->assertSame( 0, $queue->getAcquiredCount(), "No jobs active ($desc)" );
 
                $dupcount = 0;
                $jobs = [];
@@ -314,8 +314,8 @@ class JobQueueTest extends MediaWikiTestCase {
                $this->assertTrue( $queue->isEmpty(), "Queue is empty ($desc)" );
 
                $queue->flushCaches();
-               $this->assertEquals( 0, $queue->getSize(), "Queue is empty ($desc)" );
-               $this->assertEquals( 0, $queue->getAcquiredCount(), "Queue is empty ($desc)" );
+               $this->assertSame( 0, $queue->getSize(), "Queue is empty ($desc)" );
+               $this->assertSame( 0, $queue->getAcquiredCount(), "Queue is empty ($desc)" );
 
                for ( $i = 0; $i < 10; ++$i ) {
                        $this->assertNull( $queue->push( $this->newJob( $i ) ), "Push worked ($desc)" );
@@ -332,8 +332,8 @@ class JobQueueTest extends MediaWikiTestCase {
                $this->assertFalse( $queue->pop(), "Queue is not empty ($desc)" );
 
                $queue->flushCaches();
-               $this->assertEquals( 0, $queue->getSize(), "Queue is empty ($desc)" );
-               $this->assertEquals( 0, $queue->getAcquiredCount(), "No jobs active ($desc)" );
+               $this->assertSame( 0, $queue->getSize(), "Queue is empty ($desc)" );
+               $this->assertSame( 0, $queue->getAcquiredCount(), "No jobs active ($desc)" );
        }
 
        /**
index 90b57f2..c7596bf 100644 (file)
@@ -66,7 +66,7 @@ class ClearUserWatchlistJobTest extends MediaWikiTestCase {
                $this->assertEquals( 1, JobQueueGroup::singleton()->getQueueSizes()['clearUserWatchlist'] );
                $this->assertEquals( 2, $watchedItemStore->countWatchedItems( $user ) );
                $this->runJobs( 1 );
-               $this->assertEquals( 0, JobQueueGroup::singleton()->getQueueSizes()['clearUserWatchlist'] );
+               $this->assertSame( 0, JobQueueGroup::singleton()->getQueueSizes()['clearUserWatchlist'] );
                $this->assertEquals( 2, $watchedItemStore->countWatchedItems( $user ) );
 
                $this->assertTrue( $watchedItemStore->isWatched( $user, new TitleValue( 0, 'C' ) ) );
index 8e91e70..78af366 100644 (file)
@@ -16,7 +16,7 @@ class ProcessCacheLRUTest extends PHPUnit\Framework\TestCase {
         * Compare against an array so we get the cache content difference.
         */
        protected function assertCacheEmpty( $cache, $msg = 'Cache should be empty' ) {
-               $this->assertEquals( 0, $cache->getEntriesCount(), $msg );
+               $this->assertSame( 0, $cache->getEntriesCount(), $msg );
        }
 
        /**
index 581a518..90abd8c 100644 (file)
@@ -55,7 +55,7 @@ class TimingTest extends PHPUnit\Framework\TestCase {
                $this->assertEquals( 'a', $entry['name'] );
                $this->assertEquals( 'mark', $entry['entryType'] );
                $this->assertArrayHasKey( 'startTime', $entry );
-               $this->assertEquals( 0, $entry['duration'] );
+               $this->assertSame( 0, $entry['duration'] );
 
                usleep( 100 );
                $timing->mark( 'a' );
index 332e23b..3e08250 100644 (file)
@@ -82,7 +82,7 @@ class HashBagOStuffTest extends PHPUnit\Framework\TestCase {
                $cache->set( 'bar', 1, 10 );
                $cache->set( 'baz', 1, -10 );
 
-               $this->assertEquals( 0, $cacheInternal->bag['foo'][$cache::KEY_EXP], 'Indefinite' );
+               $this->assertSame( 0, $cacheInternal->bag['foo'][$cache::KEY_EXP], 'Indefinite' );
                // 2 seconds tolerance
                $this->assertEquals( time() + 10, $cacheInternal->bag['bar'][$cache::KEY_EXP], 'Future', 2 );
                $this->assertEquals( time() - 10, $cacheInternal->bag['baz'][$cache::KEY_EXP], 'Past', 2 );
index 076bf52..7c4c9bf 100644 (file)
@@ -318,7 +318,7 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                $v = $cache->getWithSetCallback(
                        $key, 30, $func, [ 'lowTTL' => 0, 'lockTSE' => 5 ] + $extOpts );
                $this->assertEquals( $value, $v, "Value returned" );
-               $this->assertEquals( 0, $wasSet, "Value not regenerated" );
+               $this->assertSame( 0, $wasSet, "Value not regenerated" );
 
                $mockWallClock += 1;
 
@@ -584,7 +584,7 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                $asycList[0](); // run the refresh callback
                $asycList = [];
                $this->assertEquals( 2, $wasSet, "Value calculated at later time" );
-               $this->assertEquals( 0, count( $asycList ), "No deferred refreshes added." );
+               $this->assertSame( 0, count( $asycList ), "No deferred refreshes added." );
                $v = $cache->getWithSetCallback( $key, 300, $func, $opts );
                $this->assertEquals( $value, $v, "New value stored" );
 
@@ -678,13 +678,13 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                        $keyedIds, 30, $genFunc, [ 'lowTTL' => 0, 'lockTSE' => 5 ] + $extOpts );
                $this->assertEquals( $value, $v[$keyB], "Value returned" );
                $this->assertEquals( 1, $wasSet, "Value regenerated" );
-               $this->assertEquals( 0, $cache->getWarmupKeyMisses(), "Keys warmed in warmup cache" );
+               $this->assertSame( 0, $cache->getWarmupKeyMisses(), "Keys warmed in warmup cache" );
 
                $v = $cache->getMultiWithSetCallback(
                        $keyedIds, 30, $genFunc, [ 'lowTTL' => 0, 'lockTSE' => 5 ] + $extOpts );
                $this->assertEquals( $value, $v[$keyB], "Value returned" );
                $this->assertEquals( 1, $wasSet, "Value not regenerated" );
-               $this->assertEquals( 0, $cache->getWarmupKeyMisses(), "Keys warmed in warmup cache" );
+               $this->assertSame( 0, $cache->getWarmupKeyMisses(), "Keys warmed in warmup cache" );
 
                $mockWallClock += 1;
 
@@ -846,13 +846,13 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                        $keyedIds, 30, $genFunc, [ 'lowTTL' => 0 ] + $extOpts );
                $this->assertEquals( $value, $v[$keyB], "Value returned" );
                $this->assertEquals( 1, $wasSet, "Value regenerated" );
-               $this->assertEquals( 0, $cache->getWarmupKeyMisses(), "Keys warmed in warmup cache" );
+               $this->assertSame( 0, $cache->getWarmupKeyMisses(), "Keys warmed in warmup cache" );
 
                $v = $cache->getMultiWithUnionSetCallback(
                        $keyedIds, 30, $genFunc, [ 'lowTTL' => 0 ] + $extOpts );
                $this->assertEquals( $value, $v[$keyB], "Value returned" );
                $this->assertEquals( 1, $wasSet, "Value not regenerated" );
-               $this->assertEquals( 0, $cache->getWarmupKeyMisses(), "Keys warmed in warmup cache" );
+               $this->assertSame( 0, $cache->getWarmupKeyMisses(), "Keys warmed in warmup cache" );
 
                $mockWallClock += 1;
 
@@ -1478,7 +1478,7 @@ class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
                $wasSet = 0;
                $v = $cache->getWithSetCallback( $key, 30, $funcV2, $verOpts + $extOpts );
                $this->assertEquals( $valueV2, $v, "Value not regenerated (secondary key)" );
-               $this->assertEquals( 0, $wasSet, "Value not regenerated (secondary key)" );
+               $this->assertSame( 0, $wasSet, "Value not regenerated (secondary key)" );
 
                // Clear out the older or unversioned key
                $cache->delete( $key, 0 );
index 4419533..16f6a6c 100644 (file)
@@ -2014,7 +2014,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
                $this->database->startAtomic( __METHOD__ );
                $wrapper->trxStatus = Database::STATUS_TRX_ERROR;
                $this->database->rollback( __METHOD__ );
-               $this->assertEquals( 0, $this->database->trxLevel() );
+               $this->assertSame( 0, $this->database->trxLevel() );
                $this->assertEquals( Database::STATUS_TRX_NONE, $wrapper->trxStatus() );
                $this->assertLastSql( 'BEGIN; ROLLBACK' );
 
@@ -2024,7 +2024,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
                $this->database->endAtomic( __METHOD__ );
                $this->assertEquals( Database::STATUS_TRX_NONE, $wrapper->trxStatus() );
                $this->assertLastSql( 'BEGIN; DELETE FROM x WHERE field = \'1\'; COMMIT' );
-               $this->assertEquals( 0, $this->database->trxLevel(), 'Use after rollback()' );
+               $this->assertSame( 0, $this->database->trxLevel(), 'Use after rollback()' );
 
                $this->database->begin( __METHOD__ );
                $this->database->startAtomic( __METHOD__, Database::ATOMIC_CANCELABLE );
@@ -2038,7 +2038,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
                $this->database->commit( __METHOD__ );
                // phpcs:ignore Generic.Files.LineLength
                $this->assertLastSql( 'BEGIN; SAVEPOINT wikimedia_rdbms_atomic1; UPDATE y SET a = \'1\' WHERE field = \'1\'; ROLLBACK TO SAVEPOINT wikimedia_rdbms_atomic1; DELETE FROM y WHERE field = \'1\'; COMMIT' );
-               $this->assertEquals( 0, $this->database->trxLevel(), 'Use after rollback()' );
+               $this->assertSame( 0, $this->database->trxLevel(), 'Use after rollback()' );
 
                // Next transaction
                $this->database->startAtomic( __METHOD__ );
@@ -2047,7 +2047,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
                $this->database->endAtomic( __METHOD__ );
                $this->assertEquals( Database::STATUS_TRX_NONE, $wrapper->trxStatus() );
                $this->assertLastSql( 'BEGIN; DELETE FROM x WHERE field = \'3\'; COMMIT' );
-               $this->assertEquals( 0, $this->database->trxLevel() );
+               $this->assertSame( 0, $this->database->trxLevel() );
        }
 
        /**
@@ -2194,7 +2194,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
 
                $this->assertFalse( $this->database->isOpen() );
                $this->assertLastSql( 'BEGIN; DELETE FROM x WHERE field = \'3\'; ROLLBACK; SELECT 2' );
-               $this->assertEquals( 0, $this->database->trxLevel() );
+               $this->assertSame( 0, $this->database->trxLevel() );
        }
 
        /**
@@ -2223,7 +2223,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
 
                $this->assertFalse( $this->database->isOpen() );
                $this->assertLastSql( 'BEGIN; DELETE FROM x WHERE field = \'3\'; ROLLBACK; SELECT 2' );
-               $this->assertEquals( 0, $this->database->trxLevel() );
+               $this->assertSame( 0, $this->database->trxLevel() );
        }
 
        /**
@@ -2246,7 +2246,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
 
                $this->assertFalse( $this->database->isOpen() );
                $this->assertLastSql( 'BEGIN; DELETE FROM x WHERE field = \'3\'; ROLLBACK' );
-               $this->assertEquals( 0, $this->database->trxLevel() );
+               $this->assertSame( 0, $this->database->trxLevel() );
        }
 
        /**
@@ -2261,7 +2261,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
 
                $this->assertFalse( $this->database->isOpen() );
                $this->assertLastSql( 'BEGIN; SELECT 1; ROLLBACK' );
-               $this->assertEquals( 0, $this->database->trxLevel() );
+               $this->assertSame( 0, $this->database->trxLevel() );
        }
 
        /**
index 93b1bf8..fddbab2 100644 (file)
@@ -490,13 +490,13 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
                $db->method( 'isOpen' )->willReturn( true );
                $db->method( 'getDBname' )->willReturn( 'unittest' );
 
-               $this->assertEquals( 0, $db->trxLevel() );
+               $this->assertSame( 0, $db->trxLevel() );
                $this->assertEquals( true, $db->lockIsFree( 'x', __METHOD__ ) );
                $this->assertEquals( true, $db->lock( 'x', __METHOD__ ) );
                $this->assertEquals( false, $db->lockIsFree( 'x', __METHOD__ ) );
                $this->assertEquals( true, $db->unlock( 'x', __METHOD__ ) );
                $this->assertEquals( true, $db->lockIsFree( 'x', __METHOD__ ) );
-               $this->assertEquals( 0, $db->trxLevel() );
+               $this->assertSame( 0, $db->trxLevel() );
 
                $db->setFlag( DBO_TRX );
                $this->assertEquals( true, $db->lockIsFree( 'x', __METHOD__ ) );
@@ -507,7 +507,7 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
                $db->clearFlag( DBO_TRX );
 
                // Pending writes with DBO_TRX
-               $this->assertEquals( 0, $db->trxLevel() );
+               $this->assertSame( 0, $db->trxLevel() );
                $this->assertTrue( $db->lockIsFree( 'meow', __METHOD__ ) );
                $db->setFlag( DBO_TRX );
                $db->query( "DELETE FROM test WHERE t = 1" ); // trigger DBO_TRX transaction before lock
@@ -521,7 +521,7 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
                $db->rollback( __METHOD__, IDatabase::FLUSHING_ALL_PEERS );
                // Pending writes without DBO_TRX
                $db->clearFlag( DBO_TRX );
-               $this->assertEquals( 0, $db->trxLevel() );
+               $this->assertSame( 0, $db->trxLevel() );
                $this->assertTrue( $db->lockIsFree( 'meow2', __METHOD__ ) );
                $db->begin( __METHOD__ );
                $db->query( "DELETE FROM test WHERE t = 1" ); // trigger DBO_TRX transaction before lock
@@ -535,17 +535,17 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
                $db->rollback( __METHOD__ );
                // No pending writes, with DBO_TRX
                $db->setFlag( DBO_TRX );
-               $this->assertEquals( 0, $db->trxLevel() );
+               $this->assertSame( 0, $db->trxLevel() );
                $this->assertTrue( $db->lockIsFree( 'wuff', __METHOD__ ) );
                $db->query( "SELECT 1", __METHOD__ );
                $this->assertEquals( 1, $db->trxLevel() );
                $lock = $db->getScopedLockAndFlush( 'wuff', __METHOD__, 1 );
-               $this->assertEquals( 0, $db->trxLevel() );
+               $this->assertSame( 0, $db->trxLevel() );
                $this->assertFalse( $db->lockIsFree( 'wuff', __METHOD__ ), 'Lock already acquired' );
                $db->rollback( __METHOD__, IDatabase::FLUSHING_ALL_PEERS );
                // No pending writes, without DBO_TRX
                $db->clearFlag( DBO_TRX );
-               $this->assertEquals( 0, $db->trxLevel() );
+               $this->assertSame( 0, $db->trxLevel() );
                $this->assertTrue( $db->lockIsFree( 'wuff2', __METHOD__ ) );
                $db->begin( __METHOD__ );
                try {
index b26a247..d176e39 100644 (file)
@@ -168,7 +168,7 @@ class LinkRendererTest extends MediaWikiLangTestCase {
 
                $linkRenderer = new LinkRenderer( $titleFormatter, $linkCache, $nsInfo );
                $linkRenderer->setStubThreshold( 0 );
-               $this->assertEquals(
+               $this->assertSame(
                        '',
                        $linkRenderer->getLinkClasses( $foobarTitle )
                );
@@ -186,7 +186,7 @@ class LinkRendererTest extends MediaWikiLangTestCase {
                );
 
                $linkRenderer->setStubThreshold( 20 );
-               $this->assertEquals(
+               $this->assertSame(
                        '',
                        $linkRenderer->getLinkClasses( $userTitle )
                );
index 630df54..8d0ddf8 100644 (file)
@@ -54,7 +54,7 @@ class JpegPixelFormatTest extends MediaWikiMediaTestCase {
                        '%[jpeg:sampling-factor]',
                        $path
                )->execute();
-               $this->assertEquals( 0,
+               $this->assertSame( 0,
                        $result->getExitCode(),
                        "ImageMagick's identify command should return success"
                );
index 22de935..4d7ff48 100644 (file)
@@ -72,9 +72,9 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase {
                $meta = PNGMetadataExtractor::getMetadata( $this->filePath .
                        'Png-native-test.png' );
 
-               $this->assertEquals( 0, $meta['frameCount'] );
+               $this->assertSame( 0, $meta['frameCount'] );
                $this->assertEquals( 1, $meta['loopCount'] );
-               $this->assertEquals( 0, $meta['duration'] );
+               $this->assertSame( 0.0, $meta['duration'] );
        }
 
        /**
@@ -87,7 +87,7 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase {
 
                $this->assertEquals( 20, $meta['frameCount'] );
                // Note loop count of 0 = infinity
-               $this->assertEquals( 0, $meta['loopCount'] );
+               $this->assertSame( 0, $meta['loopCount'] );
                $this->assertEquals( 1.5, $meta['duration'], '', 0.00001 );
        }
 
index f071e4b..f0d895e 100644 (file)
@@ -439,7 +439,7 @@ abstract class WikiPageDbTestBase extends MediaWikiLangTestCase {
                $n = $res->numRows();
                $res->free();
 
-               $this->assertEquals( 0, $n, 'pagelinks should contain no more links from the page' );
+               $this->assertSame( 0, $n, 'pagelinks should contain no more links from the page' );
        }
 
        /**
@@ -637,7 +637,7 @@ abstract class WikiPageDbTestBase extends MediaWikiLangTestCase {
                $n = $res->numRows();
                $res->free();
 
-               $this->assertEquals( 0, $n, 'pagelinks should contain no more links from the page' );
+               $this->assertSame( 0, $n, 'pagelinks should contain no more links from the page' );
        }
 
        /**
@@ -1577,20 +1577,20 @@ more stuff
                $page->updateCategoryCounts( [ 'A' ], [], 0 );
 
                $this->assertEquals( 1, Category::newFromName( 'A' )->getPageCount() );
-               $this->assertEquals( 0, Category::newFromName( 'B' )->getPageCount() );
-               $this->assertEquals( 0, Category::newFromName( 'C' )->getPageCount() );
+               $this->assertSame( 0, Category::newFromName( 'B' )->getPageCount() );
+               $this->assertSame( 0, Category::newFromName( 'C' )->getPageCount() );
 
                // Add a new category
                $page->updateCategoryCounts( [ 'B' ], [], 0 );
 
                $this->assertEquals( 1, Category::newFromName( 'A' )->getPageCount() );
                $this->assertEquals( 1, Category::newFromName( 'B' )->getPageCount() );
-               $this->assertEquals( 0, Category::newFromName( 'C' )->getPageCount() );
+               $this->assertSame( 0, Category::newFromName( 'C' )->getPageCount() );
 
                // Add and remove a category
                $page->updateCategoryCounts( [ 'C' ], [ 'A' ], 0 );
 
-               $this->assertEquals( 0, Category::newFromName( 'A' )->getPageCount() );
+               $this->assertSame( 0, Category::newFromName( 'A' )->getPageCount() );
                $this->assertEquals( 1, Category::newFromName( 'B' )->getPageCount() );
                $this->assertEquals( 1, Category::newFromName( 'C' )->getPageCount() );
        }
index 94e3461..be11d53 100644 (file)
@@ -718,7 +718,7 @@ END
                ] );
                $context = $this->getResourceLoaderContext( [], $rl );
 
-               $this->assertEquals(
+               $this->assertSame(
                        '',
                        $rl->getCombinedVersion( $context, [] ),
                        'empty list'
index 67493c4..8135d57 100644 (file)
@@ -7,7 +7,7 @@ class SearchNearMatchResultSetTest extends PHPUnit\Framework\TestCase {
         */
        public function testNumRows() {
                $resultSet = new SearchNearMatchResultSet( null );
-               $this->assertEquals( 0, $resultSet->numRows() );
+               $this->assertSame( 0, $resultSet->numRows() );
 
                $resultSet = new SearchNearMatchResultSet( Title::newMainPage() );
                $this->assertEquals( 1, $resultSet->numRows() );
index 5fb3ac0..0dd88bb 100644 (file)
@@ -65,7 +65,7 @@ class ShellTest extends MediaWikiTestCase {
 
                $wrapper = TestingAccessWrapper::newFromObject( $command );
                $this->assertEquals( $expected, $wrapper->command );
-               $this->assertEquals( 0, $wrapper->restrictions & Shell::NO_LOCALSETTINGS );
+               $this->assertSame( 0, $wrapper->restrictions & Shell::NO_LOCALSETTINGS );
        }
 
        public function provideMakeScriptCommand() {
index df12eba..fc04fb7 100644 (file)
@@ -149,7 +149,7 @@ class CachingSiteStoreTest extends \MediaWikiIntegrationTestCase {
                $this->assertNull( $site );
 
                $sites = $store->getSites();
-               $this->assertEquals( 0, $sites->count() );
+               $this->assertSame( 0, $sites->count() );
        }
 
        /**
index 14ee15b..e125d71 100644 (file)
@@ -138,7 +138,7 @@ class DBSiteStoreTest extends MediaWikiTestCase {
                $this->assertNull( $site );
 
                $sites = $store->getSites();
-               $this->assertEquals( 0, $sites->count() );
+               $this->assertSame( 0, $sites->count() );
        }
 
        /**
index 9ad61b2..2119d31 100644 (file)
@@ -222,7 +222,7 @@ class SiteTest extends MediaWikiTestCase {
                $path = '//acme.com/'; // protocol-relative URL
                $site->setPath( $type, $path );
 
-               $this->assertEquals( '', $site->getProtocol() );
+               $this->assertSame( '', $site->getProtocol() );
        }
 
        public static function provideGetPageUrl() {
index 2a4ba4b..f24255b 100644 (file)
@@ -559,10 +559,10 @@ class UserTest extends MediaWikiTestCase {
                $this->markTestSkippedIfDbType( 'postgres' );
 
                $users = User::findUsersByGroup( [] );
-               $this->assertEquals( 0, iterator_count( $users ) );
+               $this->assertSame( 0, iterator_count( $users ) );
 
                $users = User::findUsersByGroup( 'foo' );
-               $this->assertEquals( 0, iterator_count( $users ) );
+               $this->assertSame( 0, iterator_count( $users ) );
 
                $user = $this->getMutableTestUser( [ 'foo' ] )->getUser();
                $users = User::findUsersByGroup( 'foo' );
index fbb893e..e40417c 100644 (file)
@@ -1180,7 +1180,7 @@ class WatchedItemStoreUnitTest extends MediaWikiTestCase {
                $this->assertInstanceOf( WatchedItem::class, $watchedItem );
                $this->assertEquals( 1, $watchedItem->getUser()->getId() );
                $this->assertEquals( 'SomeDbKey', $watchedItem->getLinkTarget()->getDBkey() );
-               $this->assertEquals( 0, $watchedItem->getLinkTarget()->getNamespace() );
+               $this->assertSame( 0, $watchedItem->getLinkTarget()->getNamespace() );
        }
 
        public function testLoadWatchedItem_noItem() {
@@ -1382,7 +1382,7 @@ class WatchedItemStoreUnitTest extends MediaWikiTestCase {
                $this->assertInstanceOf( WatchedItem::class, $watchedItem );
                $this->assertEquals( 1, $watchedItem->getUser()->getId() );
                $this->assertEquals( 'SomeDbKey', $watchedItem->getLinkTarget()->getDBkey() );
-               $this->assertEquals( 0, $watchedItem->getLinkTarget()->getNamespace() );
+               $this->assertSame( 0, $watchedItem->getLinkTarget()->getNamespace() );
        }
 
        public function testGetWatchedItem_cachedItem() {
index 53edbf2..77fcff2 100644 (file)
@@ -233,7 +233,7 @@ class DatabaseSqliteTest extends \MediaWikiIntegrationTestCase {
                $index = $indexList->next();
                $this->assertEquals( 'baz_index2', $index->name );
                $this->assertEquals( '1', $index->unique );
-               $this->assertEquals( 0,
+               $this->assertSame( 0,
                        $db->selectField( 'sqlite_master', 'COUNT(*)', [ 'name' => 'baz' ] ),
                        'Create a temporary duplicate only'
                );
@@ -524,7 +524,7 @@ class DatabaseSqliteTest extends \MediaWikiIntegrationTestCase {
                $databaseCreation = $db->query( 'CREATE TABLE a ( a_1 )', __METHOD__ );
                $this->assertInstanceOf( ResultWrapper::class, $databaseCreation, "Failed to create table a" );
                $res = $db->select( 'a', '*' );
-               $this->assertEquals( 0, $db->numFields( $res ), "expects to get 0 fields for an empty table" );
+               $this->assertSame( 0, $db->numFields( $res ), "expects to get 0 fields for an empty table" );
                $insertion = $db->insert( 'a', [ 'a_1' => 10 ], __METHOD__ );
                $this->assertTrue( $insertion, "Insertion failed" );
                $res = $db->select( 'a', '*' );
index 2f6fa39..628d248 100644 (file)
@@ -1799,7 +1799,7 @@ class LanguageTest extends LanguageClassesTestCase {
                $s = $lang->getMessageFromDB( 'word-separator' );
                $c = $lang->getMessageFromDB( 'comma-separator' );
 
-               $this->assertEquals( '', $lang->listToText( [] ) );
+               $this->assertSame( '', $lang->listToText( [] ) );
                $this->assertEquals( 'a', $lang->listToText( [ 'a' ] ) );
                $this->assertEquals( "a{$and}{$s}b", $lang->listToText( [ 'a', 'b' ] ) );
                $this->assertEquals( "a{$c}b{$and}{$s}c", $lang->listToText( [ 'a', 'b', 'c' ] ) );
index 7647915..0387535 100644 (file)
@@ -185,7 +185,7 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
                // 2. Do the real output checking on our own.
                $lines = explode( "\n", $this->getActualOutput() );
                $this->assertGreaterThan( 1, count( $lines ), "Minimal lines of produced output" );
-               $this->assertEquals( '', array_pop( $lines ), "Output ends in LF" );
+               $this->assertSame( '', array_pop( $lines ), "Output ends in LF" );
                $timestamp_re = "[0-9]{4}-[01][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-6][0-9]";
                foreach ( $lines as $line ) {
                        $this->assertRegExp(
index 4e1aced..17487ac 100644 (file)
@@ -50,7 +50,7 @@ class DiffOpTest extends \MediaWikiUnitTestCase {
         */
        public function testNorig() {
                $obj = new FakeDiffOp();
-               $this->assertEquals( 0, $obj->norig() );
+               $this->assertSame( 0, $obj->norig() );
                $obj->orig = [ 'foo' ];
                $this->assertEquals( 1, $obj->norig() );
        }
@@ -60,7 +60,7 @@ class DiffOpTest extends \MediaWikiUnitTestCase {
         */
        public function testNclosing() {
                $obj = new FakeDiffOp();
-               $this->assertEquals( 0, $obj->nclosing() );
+               $this->assertSame( 0, $obj->nclosing() );
                $obj->closing = [ 'foo' ];
                $this->assertEquals( 1, $obj->nclosing() );
        }
index cbfddd4..2c852e0 100644 (file)
@@ -7,7 +7,7 @@ class PasswordFactoryTest extends MediaWikiUnitTestCase {
        public function testConstruct() {
                $pf = new PasswordFactory();
                $this->assertEquals( [ '' ], array_keys( $pf->getTypes() ) );
-               $this->assertEquals( '', $pf->getDefaultType() );
+               $this->assertSame( '', $pf->getDefaultType() );
 
                $pf = new PasswordFactory( [
                        'foo' => [ 'class' => 'FooPassword' ],
index fb0309d..fce21f7 100644 (file)
@@ -27,7 +27,7 @@ class SearchSuggestionSetTest extends \MediaWikiUnitTestCase {
         */
        public function testAppend() {
                $set = SearchSuggestionSet::emptySuggestionSet();
-               $this->assertEquals( 0, $set->getSize() );
+               $this->assertSame( 0, $set->getSize() );
                $set->append( new SearchSuggestion( 3 ) );
                $this->assertEquals( 3, $set->getWorstScore() );
                $this->assertEquals( 3, $set->getBestScore() );
@@ -61,7 +61,7 @@ class SearchSuggestionSetTest extends \MediaWikiUnitTestCase {
         */
        public function testInsertBest() {
                $set = SearchSuggestionSet::emptySuggestionSet();
-               $this->assertEquals( 0, $set->getSize() );
+               $this->assertSame( 0, $set->getSize() );
                $set->prepend( new SearchSuggestion( 3 ) );
                $this->assertEquals( 3, $set->getWorstScore() );
                $this->assertEquals( 3, $set->getBestScore() );
@@ -104,7 +104,7 @@ class SearchSuggestionSetTest extends \MediaWikiUnitTestCase {
                $this->assertEquals( 10, $set->getSize() );
 
                $set->shrink( 0 );
-               $this->assertEquals( 0, $set->getSize() );
+               $this->assertSame( 0, $set->getSize() );
        }
 
        // TODO: test for fromTitles
index 6512e7d..72a89dd 100644 (file)
@@ -39,16 +39,8 @@ exports.config = {
        // Sauce Labs
        // ======
        // See http://webdriver.io/guide/services/sauce.html
-       // and https://docs.saucelabs.com/reference/platforms-configurator
-       services: [ 'sauce' ],
-       user: process.env.SAUCE_USERNAME,
-       key: process.env.SAUCE_ACCESS_KEY,
-
-       // Default timeout in milliseconds for Selenium Grid requests
-       connectionRetryTimeout: 90 * 1000,
-
-       // Default request retries count
-       connectionRetryCount: 3,
+       // and https://github.com/bermi/sauce-connect-launcher#advanced-usage
+       services: process.env.SAUCE_ACCESS_KEY ? [ 'sauce' ] : [],
 
        // ==================
        // Test Files