Merge "Add missing @covers to media related tests"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 2 Feb 2019 23:44:56 +0000 (23:44 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 2 Feb 2019 23:44:56 +0000 (23:44 +0000)
53 files changed:
.phpcs.xml
RELEASE-NOTES-1.33
autoload.php
includes/exception/ILocalizedException.php [new file with mode: 0644]
includes/exception/LocalizedException.php
includes/skins/BaseTemplate.php
includes/skins/QuickTemplate.php
includes/specials/SpecialMediaStatistics.php
includes/specials/SpecialTags.php
includes/specials/SpecialTrackingCategories.php
maintenance/updateCredits.php
package.json
resources/Resources.php
resources/src/jquery.tablesorter.styles/images/sort_both.png [new file with mode: 0644]
resources/src/jquery.tablesorter.styles/images/sort_both.svg [new file with mode: 0644]
resources/src/jquery.tablesorter.styles/images/sort_down.png [new file with mode: 0644]
resources/src/jquery.tablesorter.styles/images/sort_down.svg [new file with mode: 0644]
resources/src/jquery.tablesorter.styles/images/sort_up.png [new file with mode: 0644]
resources/src/jquery.tablesorter.styles/images/sort_up.svg [new file with mode: 0644]
resources/src/jquery.tablesorter.styles/jquery.tablesorter.styles.less [new file with mode: 0644]
resources/src/jquery.tablesorter/images/sort_both.png [deleted file]
resources/src/jquery.tablesorter/images/sort_both.svg [deleted file]
resources/src/jquery.tablesorter/images/sort_down.png [deleted file]
resources/src/jquery.tablesorter/images/sort_down.svg [deleted file]
resources/src/jquery.tablesorter/images/sort_up.png [deleted file]
resources/src/jquery.tablesorter/images/sort_up.svg [deleted file]
resources/src/jquery.tablesorter/jquery.tablesorter.less [deleted file]
resources/src/jquery/jquery.makeCollapsible.js
resources/src/jquery/jquery.suggestions.js
resources/src/mediawiki.inspect.js
resources/src/mediawiki.notification/notification.js
resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js
resources/src/mediawiki.special.apisandbox/apisandbox.js
resources/src/mediawiki.special.userrights.js
tests/phpunit/includes/EditPageTest.php
tests/phpunit/includes/MovePageTest.php
tests/phpunit/includes/Revision/RevisionStoreFactoryTest.php
tests/phpunit/includes/Revision/RevisionStoreTest.php
tests/phpunit/includes/content/WikitextContentTest.php
tests/phpunit/includes/db/DatabaseSqliteTest.php
tests/phpunit/includes/debug/logger/monolog/LogstashFormatterTest.php
tests/phpunit/includes/import/ImportTest.php
tests/phpunit/includes/libs/objectcache/MultiWriteBagOStuffTest.php
tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php
tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php
tests/phpunit/includes/parser/ParserOutputTest.php
tests/phpunit/includes/parser/TidyTest.php
tests/phpunit/includes/search/SearchEnginePrefixTest.php
tests/phpunit/includes/search/SearchSuggestionSetTest.php
tests/phpunit/includes/site/MediaWikiSiteTest.php
tests/phpunit/includes/specials/SpecialBlockTest.php
tests/phpunit/includes/specials/SpecialSearchTest.php
tests/phpunit/includes/user/UserTest.php

index 3978c2a..61307aa 100644 (file)
@@ -82,7 +82,6 @@
                <exclude-pattern>*/includes/jobqueue/JobSpecification\.php</exclude-pattern>
                <exclude-pattern>*/includes/RevisionList\.php</exclude-pattern>
                <exclude-pattern>*/includes/installer/PhpBugTests\.php</exclude-pattern>
-               <exclude-pattern>*/includes/exception/LocalizedException\.php</exclude-pattern>
                <exclude-pattern>*/includes/specials/SpecialMostinterwikis\.php</exclude-pattern>
                <exclude-pattern>*/includes/cache/CacheDependency\.php</exclude-pattern>
                <exclude-pattern>*/includes/cache/CacheHelper\.php</exclude-pattern>
                <exclude-pattern>*/includes/deferred/CdnCacheUpdate\.php</exclude-pattern>
                <exclude-pattern>*/includes/diff/DairikiDiff\.php</exclude-pattern>
                <exclude-pattern>*/includes/diff/DiffEngine\.php</exclude-pattern>
-               <exclude-pattern>*/includes/exception/LocalizedException\.php</exclude-pattern>
                <exclude-pattern>*/includes/Feed\.php</exclude-pattern>
                <exclude-pattern>*/includes/filerepo/file/LocalFile\.php</exclude-pattern>
                <exclude-pattern>*/includes/gallery/PackedOverlayImageGallery\.php</exclude-pattern>
index 436d1a3..5c4832a 100644 (file)
@@ -220,6 +220,8 @@ because of Phabricator reports.
 * (T209699) The jquery.async module has been deprecated. JavaScript code that
   needs asynchronous behaviour should use Promises.
 * Password::equals() is deprecated, use verify().
+* BaseTemplate::msgWiki() and QuickTemplate::msgWiki() will be removed. Use
+  other means to fetch a properly escaped message string or Message object.
 
 === Other changes in 1.33 ===
 * (T208871) The hard-coded Google search form on the database error page was
index 0d17916..2559552 100644 (file)
@@ -648,7 +648,7 @@ $wgAutoloadLocalClasses = [
        'IEUrlExtension' => __DIR__ . '/includes/libs/IEUrlExtension.php',
        'IExpiringStore' => __DIR__ . '/includes/libs/objectcache/IExpiringStore.php',
        'IJobSpecification' => __DIR__ . '/includes/jobqueue/JobSpecification.php',
-       'ILocalizedException' => __DIR__ . '/includes/exception/LocalizedException.php',
+       'ILocalizedException' => __DIR__ . '/includes/exception/ILocalizedException.php',
        'IMaintainableDatabase' => __DIR__ . '/includes/libs/rdbms/database/IMaintainableDatabase.php',
        'IP' => __DIR__ . '/includes/libs/IP.php',
        'IPTC' => __DIR__ . '/includes/media/IPTC.php',
diff --git a/includes/exception/ILocalizedException.php b/includes/exception/ILocalizedException.php
new file mode 100644 (file)
index 0000000..048da42
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * Interface for MediaWiki-localized exceptions
+ *
+ * @since 1.29
+ * @ingroup Exception
+ */
+interface ILocalizedException {
+       /**
+        * Return a Message object for this exception
+        * @return Message
+        */
+       public function getMessageObject();
+}
index c0182d5..082d665 100644 (file)
  * @file
  */
 
-/**
- * Interface for MediaWiki-localized exceptions
- *
- * @since 1.29
- * @ingroup Exception
- */
-interface ILocalizedException {
-       /**
-        * Return a Message object for this exception
-        * @return Message
-        */
-       public function getMessageObject();
-}
-
 /**
  * Basic localized exception.
  *
index a71daa0..02247bd 100644 (file)
@@ -46,7 +46,7 @@ abstract class BaseTemplate extends QuickTemplate {
        /**
         * @param string $str
         * @warning You should never use this method. I18n messages should be escaped
-        * @deprecated 1.32 Use ->msg() or ->msgWiki() instead.
+        * @deprecated 1.32 Use ->msg() or ->getMsg() instead.
         * @suppress SecurityCheck-XSS
         * @return-taint exec_html
         */
@@ -55,7 +55,11 @@ abstract class BaseTemplate extends QuickTemplate {
                echo $this->getMsg( $str )->text();
        }
 
+       /**
+        * @deprecated since 1.33 Use ->msg() or ->getMsg() instead.
+        */
        function msgWiki( $str ) {
+               // TODO: Add wfDeprecated( __METHOD__, '1.33' ) after 1.33 got released
                echo $this->getMsg( $str )->parseAsBlock();
        }
 
index 06d0f7b..1e688eb 100644 (file)
@@ -129,7 +129,7 @@ abstract class QuickTemplate {
         * @private
         * @param string $msgKey
         * @warning You should never use this method. I18n messages should be escaped
-        * @deprecated 1.32 Use ->msg() or ->msgWiki() instead.
+        * @deprecated 1.32 Use ->msg() instead.
         * @suppress SecurityCheck-XSS
         * @return-taint exec_html
         */
@@ -140,10 +140,11 @@ abstract class QuickTemplate {
 
        /**
         * An ugly, ugly hack.
-        * @private
+        * @deprecated since 1.33 Use ->msg() instead.
         * @param string $msgKey
         */
        function msgWiki( $msgKey ) {
+               // TODO: Add wfDeprecated( __METHOD__, '1.33' ) after 1.33 got released
                global $wgOut;
 
                $text = wfMessage( $msgKey )->plain();
index 873decb..a56a745 100644 (file)
@@ -261,7 +261,10 @@ class MediaStatisticsPage extends QueryPage {
         * @param string $mediaType
         */
        protected function outputTableStart( $mediaType ) {
-               $this->getOutput()->addHTML(
+               $out = $this->getOutput();
+               $out->addModuleStyles( 'jquery.tablesorter.styles' );
+               $out->addModules( 'jquery.tablesorter' );
+               $out->addHTML(
                        Html::openElement(
                                'table',
                                [ 'class' => [
index fe8fa19..0c74e76 100644 (file)
@@ -165,6 +165,8 @@ class SpecialTags extends SpecialPage {
                        }
                }
 
+               $out->addModuleStyles( 'jquery.tablesorter.styles' );
+               $out->addModules( 'jquery.tablesorter' );
                $out->addHTML( Xml::tags(
                        'table',
                        [ 'class' => 'mw-datatable sortable mw-tags-table' ],
index 4a586b7..1afbb5e 100644 (file)
@@ -40,6 +40,8 @@ class SpecialTrackingCategories extends SpecialPage {
                $this->setHeaders();
                $this->outputHeader();
                $this->getOutput()->allowClickjacking();
+               $this->getOutput()->addModuleStyles( 'jquery.tablesorter.styles' );
+               $this->getOutput()->addModules( 'jquery.tablesorter' );
                $this->getOutput()->addHTML(
                        Html::openElement( 'table', [ 'class' => 'mw-datatable sortable',
                                'id' => 'mw-trackingcategories-table' ] ) . "\n" .
index b7e8c1c..25ce3ce 100644 (file)
@@ -26,6 +26,12 @@ if ( PHP_SAPI != 'cli' ) {
        die( "This script can only be run from the command line.\n" );
 }
 
+// class Collator is provided by the intl extension.
+// It is only suggested in composer.json, so remind here when not loaded.
+if ( !extension_loaded( 'intl' ) ) {
+       die( "This script needs the 'intl' extension to be loaded." );
+}
+
 $CREDITS = 'CREDITS';
 $START_CONTRIBUTORS = '<!-- BEGIN CONTRIBUTOR LIST -->';
 $END_CONTRIBUTORS = '<!-- END CONTRIBUTOR LIST -->';
index c0570cf..5b65a09 100644 (file)
@@ -10,7 +10,7 @@
     "selenium-test": "wdio ./tests/selenium/wdio.conf.js"
   },
   "devDependencies": {
-    "eslint-config-wikimedia": "0.10.0",
+    "eslint-config-wikimedia": "0.10.1",
     "grunt": "1.0.3",
     "grunt-banana-checker": "0.6.0",
     "grunt-contrib-copy": "1.0.0",
index 9464cf7..83f11f8 100644 (file)
@@ -320,13 +320,17 @@ return [
        'jquery.tablesorter' => [
                'targets' => [ 'desktop', 'mobile' ],
                'scripts' => 'resources/src/jquery.tablesorter/jquery.tablesorter.js',
-               'styles' => 'resources/src/jquery.tablesorter/jquery.tablesorter.less',
                'messages' => [ 'sort-descending', 'sort-ascending' ],
                'dependencies' => [
+                       'jquery.tablesorter.styles',
                        'mediawiki.RegExp',
                        'mediawiki.language.months',
                ],
        ],
+       'jquery.tablesorter.styles' => [
+               'targets' => [ 'desktop', 'mobile' ],
+               'styles' => 'resources/src/jquery.tablesorter.styles/jquery.tablesorter.styles.less',
+       ],
        'jquery.textSelection' => [
                'scripts' => 'resources/src/jquery/jquery.textSelection.js',
                'dependencies' => 'jquery.client',
diff --git a/resources/src/jquery.tablesorter.styles/images/sort_both.png b/resources/src/jquery.tablesorter.styles/images/sort_both.png
new file mode 100644 (file)
index 0000000..fc63091
Binary files /dev/null and b/resources/src/jquery.tablesorter.styles/images/sort_both.png differ
diff --git a/resources/src/jquery.tablesorter.styles/images/sort_both.svg b/resources/src/jquery.tablesorter.styles/images/sort_both.svg
new file mode 100644 (file)
index 0000000..872a8db
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="21" height="9" viewBox="0 0 21 9">
+       <path d="M14.5 5l-4 4-4-4zM14.5 4l-4-4-4 4z"/>
+</svg>
diff --git a/resources/src/jquery.tablesorter.styles/images/sort_down.png b/resources/src/jquery.tablesorter.styles/images/sort_down.png
new file mode 100644 (file)
index 0000000..ce04a0f
Binary files /dev/null and b/resources/src/jquery.tablesorter.styles/images/sort_down.png differ
diff --git a/resources/src/jquery.tablesorter.styles/images/sort_down.svg b/resources/src/jquery.tablesorter.styles/images/sort_down.svg
new file mode 100644 (file)
index 0000000..452606a
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="21" height="4" viewBox="0 0 21 4">
+       <path d="M14.5 0l-4 4-4-4z"/>
+</svg>
diff --git a/resources/src/jquery.tablesorter.styles/images/sort_up.png b/resources/src/jquery.tablesorter.styles/images/sort_up.png
new file mode 100644 (file)
index 0000000..2ebe071
Binary files /dev/null and b/resources/src/jquery.tablesorter.styles/images/sort_up.png differ
diff --git a/resources/src/jquery.tablesorter.styles/images/sort_up.svg b/resources/src/jquery.tablesorter.styles/images/sort_up.svg
new file mode 100644 (file)
index 0000000..38f6374
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="21" height="4" viewBox="0 0 21 4">
+       <path d="M6.5 4l4-4 4 4z"/>
+</svg>
diff --git a/resources/src/jquery.tablesorter.styles/jquery.tablesorter.styles.less b/resources/src/jquery.tablesorter.styles/jquery.tablesorter.styles.less
new file mode 100644 (file)
index 0000000..c941da0
--- /dev/null
@@ -0,0 +1,22 @@
+@import 'mediawiki.mixins';
+
+/* Table Sorting */
+
+.client-js .sortable:not( .jquery-tablesorter ) > thead > :last-of-type > th:not( .unsortable ),
+.jquery-tablesorter th.headerSort {
+       .background-image-svg( 'images/sort_both.svg', 'images/sort_both.png' );
+       cursor: pointer;
+       background-repeat: no-repeat;
+       background-position: center right;
+       padding-right: 21px;
+}
+
+.jquery-tablesorter {
+       th.headerSortUp {
+               .background-image-svg( 'images/sort_up.svg', 'images/sort_up.png' );
+       }
+
+       th.headerSortDown {
+               .background-image-svg( 'images/sort_down.svg', 'images/sort_down.png' );
+       }
+}
diff --git a/resources/src/jquery.tablesorter/images/sort_both.png b/resources/src/jquery.tablesorter/images/sort_both.png
deleted file mode 100644 (file)
index fc63091..0000000
Binary files a/resources/src/jquery.tablesorter/images/sort_both.png and /dev/null differ
diff --git a/resources/src/jquery.tablesorter/images/sort_both.svg b/resources/src/jquery.tablesorter/images/sort_both.svg
deleted file mode 100644 (file)
index 872a8db..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="21" height="9" viewBox="0 0 21 9">
-       <path d="M14.5 5l-4 4-4-4zM14.5 4l-4-4-4 4z"/>
-</svg>
diff --git a/resources/src/jquery.tablesorter/images/sort_down.png b/resources/src/jquery.tablesorter/images/sort_down.png
deleted file mode 100644 (file)
index ce04a0f..0000000
Binary files a/resources/src/jquery.tablesorter/images/sort_down.png and /dev/null differ
diff --git a/resources/src/jquery.tablesorter/images/sort_down.svg b/resources/src/jquery.tablesorter/images/sort_down.svg
deleted file mode 100644 (file)
index 452606a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="21" height="4" viewBox="0 0 21 4">
-       <path d="M14.5 0l-4 4-4-4z"/>
-</svg>
diff --git a/resources/src/jquery.tablesorter/images/sort_up.png b/resources/src/jquery.tablesorter/images/sort_up.png
deleted file mode 100644 (file)
index 2ebe071..0000000
Binary files a/resources/src/jquery.tablesorter/images/sort_up.png and /dev/null differ
diff --git a/resources/src/jquery.tablesorter/images/sort_up.svg b/resources/src/jquery.tablesorter/images/sort_up.svg
deleted file mode 100644 (file)
index 38f6374..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="21" height="4" viewBox="0 0 21 4">
-       <path d="M6.5 4l4-4 4 4z"/>
-</svg>
diff --git a/resources/src/jquery.tablesorter/jquery.tablesorter.less b/resources/src/jquery.tablesorter/jquery.tablesorter.less
deleted file mode 100644 (file)
index ce24b0d..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-@import 'mediawiki.mixins';
-
-/* Table Sorting */
-
-table.jquery-tablesorter {
-       th.headerSort {
-               .background-image-svg( 'images/sort_both.svg', 'images/sort_both.png' );
-               cursor: pointer;
-               background-repeat: no-repeat;
-               background-position: center right;
-               padding-right: 21px;
-       }
-
-       th.headerSortUp {
-               .background-image-svg( 'images/sort_up.svg', 'images/sort_up.png' );
-       }
-
-       th.headerSortDown {
-               .background-image-svg( 'images/sort_down.svg', 'images/sort_down.png' );
-       }
-}
index f5f0475..09306f6 100644 (file)
@@ -82,7 +82,6 @@
                        }
                }
 
-               // eslint-disable-next-line jquery/no-animate-toggle
                $containers.toggle( action === 'expand' );
                hookCallback();
        }
index 01d2ba5..d9a094c 100644 (file)
                                // Only fetch if the value in the textbox changed and is not empty, or if the results were hidden
                                // if the textbox is empty then clear the result div, but leave other settings intouched
                                if ( val.length === 0 ) {
-                                       // eslint-disable-next-line jquery/no-animate-toggle
                                        $.suggestions.hide( context );
                                        context.data.prevText = '';
                                } else if (
                                        if ( context.data !== undefined ) {
                                                if ( context.data.$textbox.val().length === 0 ) {
                                                        // Hide the div when no suggestion exist
-                                                       // eslint-disable-next-line jquery/no-animate-toggle
                                                        $.suggestions.hide( context );
                                                } else {
                                                        // Rebuild the suggestions list
                                        break;
                                // Escape
                                case 27:
-                                       // eslint-disable-next-line jquery/no-animate-toggle
                                        $.suggestions.hide( context );
                                        $.suggestions.restore( context );
                                        $.suggestions.cancel( context );
                                case 13:
                                        preventDefault = wasVisible;
                                        selected = context.data.$container.find( '.suggestions-result-current' );
-                                       // eslint-disable-next-line jquery/no-animate-toggle
                                        $.suggestions.hide( context );
                                        if ( selected.length === 0 || context.data.selectedWithMouse ) {
                                                // If nothing is selected or if something was selected with the mouse
                                                                        // This will hide the link we're just clicking on, which causes problems
                                                                        // when done synchronously in at least Firefox 3.6 (T64858).
                                                                        setTimeout( function () {
-                                                                               // eslint-disable-next-line jquery/no-animate-toggle
                                                                                $.suggestions.hide( context );
                                                                        } );
                                                                }
                                                                        // This will hide the link we're just clicking on, which causes problems
                                                                        // when done synchronously in at least Firefox 3.6 (T64858).
                                                                        setTimeout( function () {
-                                                                               // eslint-disable-next-line jquery/no-animate-toggle
                                                                                $.suggestions.hide( context );
                                                                        } );
                                                                }
                                        } )
                                        .on( 'keypress', function ( e ) {
                                                context.data.keypressedCount++;
-                                               // eslint-disable-next-line jquery/no-event-shorthand
                                                $.suggestions.keypress( e, context, context.data.keypressed );
                                        } )
                                        .on( 'keyup', function ( e ) {
                                                        e.which === context.data.keypressed &&
                                                        allowed.indexOf( e.which ) !== -1
                                                ) {
-                                                       // eslint-disable-next-line jquery/no-event-shorthand
                                                        $.suggestions.keypress( e, context, context.data.keypressed );
                                                }
                                        } )
                                                if ( context.data.mouseDownOn.length > 0 ) {
                                                        return;
                                                }
-                                               // eslint-disable-next-line jquery/no-animate-toggle
                                                $.suggestions.hide( context );
                                                $.suggestions.cancel( context );
                                        } );
index 72a27fa..849ccbc 100644 (file)
                } );
        }
 
-       function humanSize( bytes ) {
+       function humanSize( bytesInput ) {
                var i,
+                       bytes = +bytesInput,
                        units = [ '', ' KiB', ' MiB', ' GiB', ' TiB', ' PiB' ];
 
-               if ( !$.isNumeric( bytes ) || bytes === 0 ) {
-                       return bytes;
+               if ( bytes === 0 || isNaN( bytes ) ) {
+                       return bytesInput;
                }
 
                for ( i = 0; bytes >= 1024; bytes /= 1024 ) {
index 2765d07..e8450df 100644 (file)
                                        $area.css( 'display', 'none' );
                                        notif.$notification.remove();
                                } else {
+                                       // FIXME: Use CSS transition
+                                       // eslint-disable-next-line jquery/no-slide
                                        notif.$notification.slideUp( 'fast', function () {
                                                $( this ).remove();
                                        } );
index 1651432..6eb8867 100644 (file)
                                        title: '', // Because it's a hidden group, this title actually appears nowhere
                                        hidden: true,
                                        allowArbitrary: true,
+                                       // FIXME: $.isNumeric is deprecated
                                        validate: $.isNumeric,
                                        range: {
                                                min: 0, // The server normalizes negative numbers to 0 results
                                        title: '', // Because it's a hidden group, this title actually appears nowhere
                                        hidden: true,
                                        allowArbitrary: true,
+                                       // FIXME: $.isNumeric is deprecated
                                        validate: $.isNumeric,
                                        range: {
                                                min: 0,
         * @param {number|string} newValue New value
         */
        mw.rcfilters.Controller.prototype.updateNumericPreference = function ( prefName, newValue ) {
+               // FIXME: $.isNumeric is deprecated
+               // eslint-disable-next-line jquery/no-is-numeric
                if ( !$.isNumeric( newValue ) ) {
                        return;
                }
index 19eac98..68c7ddc 100644 (file)
                        // OO.ui.ButtonWidget doesn't take focus itself (T128054)
                        $focus = $( '#mw-apisandbox-ui' ).find( document.activeElement );
                        if ( $focus.length ) {
-                               // eslint-disable-next-line jquery/no-event-shorthand
                                $focus[ 0 ].blur();
                        }
 
                                }
 
                                that.deprecatedItemsFieldset = new OO.ui.FieldsetLayout().addItems( deprecatedItems ).toggle( false );
-                               // eslint-disable-next-line jquery/no-animate-toggle
                                tmp = $( '<fieldset>' )
                                        .toggle( !that.deprecatedItemsFieldset.isEmpty() )
                                        .append(
index 63d9623..a4f5d1a 100644 (file)
@@ -12,7 +12,6 @@
 
        // Dynamically show/hide the "other time" input under each dropdown
        $( '.mw-userrights-nested select' ).on( 'change', function ( e ) {
-               // eslint-disable-next-line jquery/no-animate-toggle
                $( e.target.parentNode ).find( 'input' ).toggle( $( e.target ).val() === 'other' );
        } );
 
index 55d8fbb..f5fef61 100644 (file)
@@ -368,6 +368,9 @@ class EditPageTest extends MediaWikiLangTestCase {
                }
        }
 
+       /**
+        * @covers EditPage
+        */
        public function testUpdatePage() {
                $checkIds = [];
 
@@ -414,6 +417,9 @@ class EditPageTest extends MediaWikiLangTestCase {
                $this->assertGreaterThan( $checkIds[0], $checkIds[1], "Second event rev ID is higher" );
        }
 
+       /**
+        * @covers EditPage
+        */
        public function testUpdatePageTrx() {
                $text = "one";
                $edit = [
@@ -684,6 +690,7 @@ hello
 
        /**
         * @depends testAutoMerge
+        * @covers EditPage
         */
        public function testCheckDirectEditingDisallowed_forNonTextContent() {
                $title = Title::newFromText( 'Dummy:NonTextPageForEditPage' );
index 607f4f7..1b2b159 100644 (file)
@@ -65,6 +65,7 @@ class MovePageTest extends MediaWikiTestCase {
 
        /**
         * Test for the move operation being aborted via the TitleMove hook
+        * @covers MovePage::move
         */
        public function testMoveAbortedByTitleMoveHook() {
                $error = 'Preventing move operation with TitleMove hook.';
index 2e61745..138d6bc 100644 (file)
@@ -23,6 +23,9 @@ use Wikimedia\TestingAccessWrapper;
 
 class RevisionStoreFactoryTest extends MediaWikiTestCase {
 
+       /**
+        * @covers \MediaWiki\Revision\RevisionStoreFactory::__construct
+        */
        public function testValidConstruction_doesntCauseErrors() {
                new RevisionStoreFactory(
                        $this->getMockLoadBalancerFactory(),
@@ -49,6 +52,7 @@ class RevisionStoreFactoryTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideWikiIds
+        * @covers \MediaWiki\Revision\RevisionStoreFactory::getRevisionStore
         */
        public function testGetRevisionStore(
                $wikiId,
index efc2952..c4b274d 100644 (file)
@@ -146,6 +146,9 @@ class RevisionStoreTest extends MediaWikiTestCase {
                $this->assertSame( $contentHandlerDb, $store->getContentHandlerUseDB() );
        }
 
+       /**
+        * @covers \MediaWiki\Revision\RevisionStore::getTitle
+        */
        public function testGetTitle_successFromPageId() {
                $mockLoadBalancer = $this->getMockLoadBalancer();
                // Title calls wfGetDB() so we have to set the main service
@@ -177,6 +180,9 @@ class RevisionStoreTest extends MediaWikiTestCase {
                $this->assertSame( 'Food', $title->getDBkey() );
        }
 
+       /**
+        * @covers \MediaWiki\Revision\RevisionStore::getTitle
+        */
        public function testGetTitle_successFromPageIdOnFallback() {
                $mockLoadBalancer = $this->getMockLoadBalancer();
                // Title calls wfGetDB() so we have to set the main service
@@ -233,6 +239,9 @@ class RevisionStoreTest extends MediaWikiTestCase {
                $this->assertSame( 'Foodey', $title->getDBkey() );
        }
 
+       /**
+        * @covers \MediaWiki\Revision\RevisionStore::getTitle
+        */
        public function testGetTitle_successFromRevId() {
                $mockLoadBalancer = $this->getMockLoadBalancer();
                // Title calls wfGetDB() so we have to set the main service
@@ -278,6 +287,9 @@ class RevisionStoreTest extends MediaWikiTestCase {
                $this->assertSame( 'Food2', $title->getDBkey() );
        }
 
+       /**
+        * @covers \MediaWiki\Revision\RevisionStore::getTitle
+        */
        public function testGetTitle_successFromRevIdOnFallback() {
                $mockLoadBalancer = $this->getMockLoadBalancer();
                // Title calls wfGetDB() so we have to set the main service
index f689cae..2fc7794 100644 (file)
@@ -360,6 +360,10 @@ just a test"
                $this->assertEquals( CONTENT_MODEL_WIKITEXT, $content->getContentHandler()->getModelID() );
        }
 
+       /**
+        * @covers ParserOptions::getRedirectTarget
+        * @covers ParserOptions::setRedirectTarget
+        */
        public function testRedirectParserOption() {
                $title = Title::newFromText( 'testRedirectParserOption' );
 
index eebb045..e61bd05 100644 (file)
@@ -474,6 +474,9 @@ class DatabaseSqliteTest extends MediaWikiTestCase {
                return $indexes;
        }
 
+       /**
+        * @coversNothing
+        */
        public function testCaseInsensitiveLike() {
                // TODO: Test this for all databases
                $db = DatabaseSqlite::newStandaloneInstance( ':memory:' );
index 1ee188e..a1207b2 100644 (file)
@@ -5,6 +5,7 @@ namespace MediaWiki\Logger\Monolog;
 class LogstashFormatterTest extends \PHPUnit\Framework\TestCase {
        /**
         * @dataProvider provideV1
+        * @covers MediaWiki\Logger\Monolog\LogstashFormatter::formatV1
         * @param array $record The input record.
         * @param array $expected Associative array of expected keys and their values.
         * @param array $notExpected List of keys that should not exist.
@@ -42,6 +43,9 @@ class LogstashFormatterTest extends \PHPUnit\Framework\TestCase {
                ];
        }
 
+       /**
+        * @covers MediaWiki\Logger\Monolog\LogstashFormatter::formatV1
+        */
        public function testV1WithPrefix() {
                $formatter = new LogstashFormatter( 'app', 'system', null, 'ctx_', LogstashFormatter::V1 );
                $record = [ 'extra' => [ 'url' => 1 ], 'context' => [ 'url' => 2 ] ];
index 3b91f5b..892bdcf 100644 (file)
@@ -222,6 +222,9 @@ EOF
 
        /**
         * @dataProvider provideUnknownUserHandling
+        * @covers WikiImporter::setUsernamePrefix
+        * @covers ExternalUserNames::addPrefix
+        * @covers ExternalUserNames::applyPrefix
         * @param bool $assign
         * @param bool $create
         */
index 8a95ae7..0376803 100644 (file)
@@ -138,6 +138,9 @@ class MultiWriteBagOStuffTest extends MediaWikiTestCase {
                $this->assertSame( 'special', $cache->makeGlobalKey( 'a', 'b' ) );
        }
 
+       /**
+        * @covers MultiWriteBagOStuff::add
+        */
        public function testDuplicateStoreAdd() {
                $bag = new HashBagOStuff();
                $cache = new MultiWriteBagOStuff( [
index b7dbe0b..4c92545 100644 (file)
@@ -672,7 +672,7 @@ class DatabaseMysqlBaseTest extends PHPUnit\Framework\TestCase {
                $this->assertSame( 'CAST( fieldName AS SIGNED )', $output );
        }
 
-       /*
+       /**
         * @covers Wikimedia\Rdbms\Database::setIndexAliases
         */
        public function testIndexAliases() {
index 4a9603c..d1d1aa3 100644 (file)
@@ -740,6 +740,10 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
                ];
        }
 
+       /**
+        * @covers Wikimedia\Rdbms\Database::insertSelect
+        * @covers Wikimedia\Rdbms\Database::nativeInsertSelect
+        */
        public function testInsertSelectBatching() {
                $dbWeb = new DatabaseTestHelper( __CLASS__, [ 'cliMode' => false ] );
                $rows = [];
@@ -1874,6 +1878,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
 
        /**
         * @expectedException \Wikimedia\Rdbms\DBTransactionStateError
+        * @covers \Wikimedia\Rdbms\Database::assertTransactionStatus
         */
        public function testTransactionErrorState1() {
                $wrapper = TestingAccessWrapper::newFromObject( $this->database );
index 390ea41..cb8257c 100644 (file)
@@ -849,6 +849,11 @@ EOF
                $this->assertFieldValues( $a, $expected );
        }
 
+       /**
+        * @covers ParserOutput::mergeInternalMetaDataFrom
+        * @covers ParserOutput::getTimes
+        * @covers ParserOutput::resetParseStartTime
+        */
        public function testMergeInternalMetaDataFrom_parseStartTime() {
                /** @var object $a */
                $a = new ParserOutput();
index be5125c..898ef2d 100644 (file)
@@ -2,6 +2,7 @@
 
 /**
  * @group Parser
+ * @covers MWTidy
  */
 class TidyTest extends MediaWikiTestCase {
 
index ee272b9..372cb33 100644 (file)
@@ -382,6 +382,7 @@ class SearchEnginePrefixTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider paginationProvider
+        * @covers SearchSuggestionSet::hasMoreResults
         */
        public function testPagination( $hasMoreResults, $provision ) {
                $search = $this->mockSearchWithResults( $provision );
index 54533a7..02fa5e9 100644 (file)
@@ -23,6 +23,7 @@ class SearchSuggestionSetTest extends \PHPUnit\Framework\TestCase {
        /**
         * Test that adding a new suggestion at the end
         * will keep proper score ordering
+        * @covers SearchSuggestionSet::append
         */
        public function testAppend() {
                $set = SearchSuggestionSet::emptySuggestionSet();
@@ -54,6 +55,9 @@ class SearchSuggestionSetTest extends \PHPUnit\Framework\TestCase {
        /**
         * Test that adding a new best suggestion will keep proper score
         * ordering
+        * @covers SearchSuggestionSet::getWorstScore
+        * @covers SearchSuggestionSet::getBestScore
+        * @covers SearchSuggestionSet::prepend
         */
        public function testInsertBest() {
                $set = SearchSuggestionSet::emptySuggestionSet();
@@ -88,6 +92,9 @@ class SearchSuggestionSetTest extends \PHPUnit\Framework\TestCase {
                $this->assertEquals( $sorted, $scores );
        }
 
+       /**
+        * @covers SearchSuggestionSet::shrink
+        */
        public function testShrink() {
                $set = SearchSuggestionSet::emptySuggestionSet();
                for ( $i = 0; $i < 100; $i++ ) {
index b367979..d198462 100644 (file)
@@ -30,6 +30,9 @@
  */
 class MediaWikiSiteTest extends SiteTest {
 
+       /**
+        * @covers MediaWikiSite::normalizePageName
+        */
        public function testNormalizePageTitle() {
                $this->setMwGlobals( [
                        'wgCapitalLinks' => true,
index 55a8b66..0643e0e 100644 (file)
@@ -29,6 +29,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
        public function testGetFormFields() {
                $this->setMwGlobals( [
                        'wgEnablePartialBlocks' => false,
+                       'wgBlockAllowsUTEdit' => true,
                ] );
                $page = $this->newSpecialPage();
                $wrappedPage = TestingAccessWrapper::newFromObject( $page );
@@ -71,6 +72,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
        public function testMaybeAlterFormDefaults() {
                $this->setMwGlobals( [
                        'wgEnablePartialBlocks' => false,
+                       'wgBlockAllowsUTEdit' => true,
                ] );
 
                $block = $this->insertBlock();
index 6ff2110..1a4fe4f 100644 (file)
@@ -114,6 +114,7 @@ class SpecialSearchTest extends MediaWikiTestCase {
        /**
         * Verify we do not expand search term in <title> on search result page
         * https://gerrit.wikimedia.org/r/4841
+        * @covers SpecialSearch::setupPage
         */
        public function testSearchTermIsNotExpanded() {
                $this->setMwGlobals( [
@@ -175,6 +176,7 @@ class SpecialSearchTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideRewriteQueryWithSuggestion
+        * @covers SpecialSearch::showResults
         */
        public function testRewriteQueryWithSuggestion(
                $message,
@@ -224,6 +226,9 @@ class SpecialSearchTest extends MediaWikiTestCase {
                return $mock;
        }
 
+       /**
+        * @covers SpecialSearch::execute
+        */
        public function testSubPageRedirect() {
                $this->setMwGlobals( [
                        'wgScript' => '/w/index.php',
index 84f9378..b8806e7 100644 (file)
@@ -583,6 +583,7 @@ class UserTest extends MediaWikiTestCase {
         * When a user is autoblocked a cookie is set with which to track them
         * in case they log out and change IP addresses.
         * @link https://phabricator.wikimedia.org/T5233
+        * @covers User::trackBlockWithCookie
         */
        public function testAutoblockCookies() {
                // Set up the bits of global configuration that we use.
@@ -665,6 +666,7 @@ class UserTest extends MediaWikiTestCase {
        /**
         * Make sure that no cookie is set to track autoblocked users
         * when $wgCookieSetOnAutoblock is false.
+        * @covers User::trackBlockWithCookie
         */
        public function testAutoblockCookiesDisabled() {
                // Set up the bits of global configuration that we use.
@@ -712,6 +714,7 @@ class UserTest extends MediaWikiTestCase {
         * When a user is autoblocked and a cookie is set to track them, the expiry time of the cookie
         * should match the block's expiry, to a maximum of 24 hours. If the expiry time is changed,
         * the cookie's should change with it.
+        * @covers User::trackBlockWithCookie
         */
        public function testAutoblockCookieInfiniteExpiry() {
                $this->setMwGlobals( [
@@ -776,6 +779,9 @@ class UserTest extends MediaWikiTestCase {
                $block->delete();
        }
 
+       /**
+        * @covers User::getBlockedStatus
+        */
        public function testSoftBlockRanges() {
                global $wgUser;
 
@@ -807,6 +813,7 @@ class UserTest extends MediaWikiTestCase {
 
        /**
         * Test that a modified BlockID cookie doesn't actually load the relevant block (T152951).
+        * @covers User::trackBlockWithCookie
         */
        public function testAutoblockCookieInauthentic() {
                // Set up the bits of global configuration that we use.
@@ -853,6 +860,7 @@ class UserTest extends MediaWikiTestCase {
        /**
         * The BlockID cookie is normally verified with a HMAC, but not if wgSecretKey is not set.
         * This checks that a non-authenticated cookie still works.
+        * @covers User::trackBlockWithCookie
         */
        public function testAutoblockCookieNoSecretKey() {
                // Set up the bits of global configuration that we use.
@@ -1022,6 +1030,9 @@ class UserTest extends MediaWikiTestCase {
                $this->assertTrue( User::isLocallyBlockedProxy( $ip ) );
        }
 
+       /**
+        * @covers User::newFromActorId
+        */
        public function testActorId() {
                $domain = MediaWikiServices::getInstance()->getDBLoadBalancer()->getLocalDomainID();
                $this->hideDeprecated( 'User::selectFields' );
@@ -1085,6 +1096,9 @@ class UserTest extends MediaWikiTestCase {
                        'User::newFromActorId works for an anonymous user' );
        }
 
+       /**
+        * @covers User::newFromAnyId
+        */
        public function testNewFromAnyId() {
                // Registered user
                $user = $this->getTestUser()->getUser();
@@ -1337,6 +1351,7 @@ class UserTest extends MediaWikiTestCase {
        /**
         * Block cookie should be set for IP Blocks if
         * wgCookieSetOnIpBlock is set to true
+        * @covers User::trackBlockWithCookie
         */
        public function testIpBlockCookieSet() {
                $this->setMwGlobals( [
@@ -1372,6 +1387,7 @@ class UserTest extends MediaWikiTestCase {
        /**
         * Block cookie should NOT be set when wgCookieSetOnIpBlock
         * is disabled
+        * @covers User::trackBlockWithCookie
         */
        public function testIpBlockCookieNotSet() {
                $this->setMwGlobals( [
@@ -1407,6 +1423,7 @@ class UserTest extends MediaWikiTestCase {
        /**
         * When an ip user is blocked and then they log in, cookie block
         * should be invalid and the cookie removed.
+        * @covers User::trackBlockWithCookie
         */
        public function testIpBlockCookieIgnoredWhenUserLoggedIn() {
                $this->setMwGlobals( [