Merge "ResourceLoaderOOUIIconPackModule: Always use MW core 'localBasePath'"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 11 Jun 2019 23:11:58 +0000 (23:11 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 11 Jun 2019 23:11:58 +0000 (23:11 +0000)
18 files changed:
.phpcs.xml
includes/installer/i18n/en.json
resources/src/jquery/jquery.suggestions.js
tests/phpunit/includes/ActorMigrationTest.php
tests/phpunit/includes/TitleArrayFromResultTest.php
tests/phpunit/includes/import/ImportTest.php
tests/phpunit/includes/user/UserArrayFromResultTest.php
tests/phpunit/structure/ApiPrefixUniquenessTest.php
tests/phpunit/structure/ApiStructureTest.php
tests/phpunit/structure/AutoLoaderStructureTest.php
tests/phpunit/structure/AvailableRightsTest.php
tests/phpunit/structure/ContentHandlerSanityTest.php
tests/phpunit/structure/DatabaseIntegrationTest.php
tests/phpunit/structure/ExtensionJsonValidationTest.php
tests/phpunit/structure/PasswordPolicyStructureTest.php
tests/phpunit/structure/ResourcesTest.php
tests/phpunit/structure/SpecialPageFatalTest.php
tests/phpunit/structure/StructureTest.php

index 22b74b5..9ccf565 100644 (file)
                -->
                <exclude-pattern>*/maintenance/mwdocgen\.php</exclude-pattern>
        </rule>
+       <rule ref="MediaWiki.Commenting.MissingCovers.MissingCovers">
+               <exclude-pattern>tests/phpunit/structure/*</exclude-pattern>
+       </rule>
        <file>.</file>
        <arg name="encoding" value="UTF-8"/>
        <arg name="extensions" value="php,php5,inc,sample"/>
index 3705a8d..5b9742b 100644 (file)
@@ -45,8 +45,8 @@
        "config-env-bad": "The environment has been checked.\nYou cannot install MediaWiki.",
        "config-env-php": "PHP $1 is installed.",
        "config-env-hhvm": "HHVM $1 is installed.",
-       "config-unicode-using-intl": "Using the [https://pecl.php.net/intl intl PECL extension] for Unicode normalization.",
-       "config-unicode-pure-php-warning": "<strong>Warning:</strong> The [https://pecl.php.net/intl intl PECL extension] is not available to handle Unicode normalization, falling back to slow pure-PHP implementation.\nIf you run a high-traffic site, you should read a little on [https://www.mediawiki.org/wiki/Special:MyLanguage/Unicode_normalization_considerations Unicode normalization].",
+       "config-unicode-using-intl": "Using the [https://php.net/manual/en/book.intl.php PHP intl extension] for Unicode normalization.",
+       "config-unicode-pure-php-warning": "<strong>Warning:</strong> The [https://php.net/manual/en/book.intl.php PHP intl extension] is not available to handle Unicode normalization, falling back to slow pure-PHP implementation.\nIf you run a high-traffic site, you should read on [https://www.mediawiki.org/wiki/Special:MyLanguage/Unicode_normalization_considerations Unicode normalization].",
        "config-unicode-update-warning": "<strong>Warning:</strong> The installed version of the Unicode normalization wrapper uses an older version of [http://site.icu-project.org/ the ICU project's] library.\nYou should [https://www.mediawiki.org/wiki/Special:MyLanguage/Unicode_normalization_considerations upgrade] if you are at all concerned about using Unicode.",
        "config-no-db": "Could not find a suitable database driver! You need to install a database driver for PHP.\nThe following database {{PLURAL:$2|type is|types are}} supported: $1.\n\nIf you compiled PHP yourself, reconfigure it with a database client enabled, for example, using <code>./configure --with-mysqli</code>.\nIf you installed PHP from a Debian or Ubuntu package, then you also need to install, for example, the <code>php-mysql</code> package.",
        "config-outdated-sqlite": "<strong>Warning:</strong> you have SQLite $2, which is lower than minimum required version $1. SQLite will be unavailable.",
index 26028e7..3083b0f 100644 (file)
                                        } );
                                // Load suggestions if the value is changed because there are already
                                // typed characters before the JavaScript is loaded.
-                               if ( this.value !== this.defaultValue ) {
+                               if ( $( this ).is( ':focus' ) && this.value !== this.defaultValue ) {
                                        update( context, false );
                                }
                        }
index de70f26..40c45dc 100644 (file)
@@ -18,15 +18,6 @@ class ActorMigrationTest extends MediaWikiLangTestCase {
                'actor',
        ];
 
-       /**
-        * Create an ActorMigration for a particular stage
-        * @param int $stage
-        * @return ActorMigration
-        */
-       protected function makeMigration( $stage ) {
-               return new ActorMigration( $stage );
-       }
-
        /**
         * @dataProvider provideConstructor
         * @param int $stage
@@ -81,7 +72,7 @@ class ActorMigrationTest extends MediaWikiLangTestCase {
         * @param array $expect
         */
        public function testGetJoin( $stage, $key, $expect ) {
-               $m = $this->makeMigration( $stage );
+               $m = new ActorMigration( $stage );
                $result = $m->getJoin( $key );
                $this->assertEquals( $expect, $result );
        }
@@ -260,7 +251,7 @@ class ActorMigrationTest extends MediaWikiLangTestCase {
                        $users = reset( $users );
                }
 
-               $m = $this->makeMigration( $stage );
+               $m = new ActorMigration( $stage );
                $result = $m->getWhere( $this->db, $key, $users, $useId );
                $this->assertEquals( $expect, $result );
        }
@@ -510,7 +501,7 @@ class ActorMigrationTest extends MediaWikiLangTestCase {
                                $extraFields['ipb_address'] = __CLASS__ . "#{$stageNames[$writeStage]}";
                        }
 
-                       $w = $this->makeMigration( $writeStage );
+                       $w = new ActorMigration( $writeStage );
                        $usesTemp = $key === 'rev_user';
 
                        if ( $usesTemp ) {
@@ -543,7 +534,7 @@ class ActorMigrationTest extends MediaWikiLangTestCase {
                        }
 
                        foreach ( $possibleReadStages as $readStage ) {
-                               $r = $this->makeMigration( $readStage );
+                               $r = new ActorMigration( $readStage );
 
                                $queryInfo = $r->getJoin( $key );
                                $row = $this->db->selectRow(
@@ -615,7 +606,7 @@ class ActorMigrationTest extends MediaWikiLangTestCase {
         * @expectedExceptionMessage Must use getInsertValuesWithTempTable() for rev_user
         */
        public function testInsertWrong( $stage ) {
-               $m = $this->makeMigration( $stage );
+               $m = new ActorMigration( $stage );
                $m->getInsertValues( $this->db, 'rev_user', $this->getTestUser()->getUser() );
        }
 
@@ -626,7 +617,7 @@ class ActorMigrationTest extends MediaWikiLangTestCase {
         * @expectedExceptionMessage Must use getInsertValues() for rc_user
         */
        public function testInsertWithTempTableWrong( $stage ) {
-               $m = $this->makeMigration( $stage );
+               $m = new ActorMigration( $stage );
                $m->getInsertValuesWithTempTable( $this->db, 'rc_user', $this->getTestUser()->getUser() );
        }
 
@@ -639,7 +630,7 @@ class ActorMigrationTest extends MediaWikiLangTestCase {
                $wrap->formerTempTables += [ 'rc_user' => '1.30' ];
 
                $this->hideDeprecated( 'ActorMigration::getInsertValuesWithTempTable for rc_user' );
-               $m = $this->makeMigration( $stage );
+               $m = new ActorMigration( $stage );
                list( $fields, $callback )
                        = $m->getInsertValuesWithTempTable( $this->db, 'rc_user', $this->getTestUser()->getUser() );
                $this->assertTrue( is_callable( $callback ) );
@@ -652,7 +643,7 @@ class ActorMigrationTest extends MediaWikiLangTestCase {
         * @expectedExceptionMessage $extra[rev_timestamp] is not provided
         */
        public function testInsertWithTempTableCallbackMissingFields( $stage ) {
-               $m = $this->makeMigration( $stage );
+               $m = new ActorMigration( $stage );
                list( $fields, $callback )
                        = $m->getInsertValuesWithTempTable( $this->db, 'rev_user', $this->getTestUser()->getUser() );
                $callback( 1, [] );
@@ -677,7 +668,7 @@ class ActorMigrationTest extends MediaWikiLangTestCase {
 
                list( $cFields, $cCallback ) = MediaWikiServices::getInstance()->getCommentStore()
                        ->insertWithTempTable( $this->db, 'rev_comment', '' );
-               $m = $this->makeMigration( $stage );
+               $m = new ActorMigration( $stage );
                list( $fields, $callback ) =
                        $m->getInsertValuesWithTempTable( $this->db, 'rev_user', $userIdentity );
                $extraFields = [
@@ -701,7 +692,7 @@ class ActorMigrationTest extends MediaWikiLangTestCase {
                        (int)$row->rev_actor
                );
 
-               $m = $this->makeMigration( $stage );
+               $m = new ActorMigration( $stage );
                $fields = $m->getInsertValues( $this->db, 'dummy_user', $userIdentity );
                if ( $stage & SCHEMA_COMPAT_WRITE_OLD ) {
                        $this->assertSame( $user->getId(), $fields['dummy_user'] );
@@ -730,7 +721,7 @@ class ActorMigrationTest extends MediaWikiLangTestCase {
         * @param string $isNotAnon
         */
        public function testIsAnon( $stage, $isAnon, $isNotAnon ) {
-               $m = $this->makeMigration( $stage );
+               $m = new ActorMigration( $stage );
                $this->assertSame( $isAnon, $m->isAnon( 'foo' ) );
                $this->assertSame( $isNotAnon, $m->isNotAnon( 'foo' ) );
        }
index af49ecf..32c7571 100644 (file)
@@ -30,10 +30,6 @@ class TitleArrayFromResultTest extends PHPUnit\Framework\TestCase {
                return $row;
        }
 
-       private function getTitleArrayFromResult( $resultWrapper ) {
-               return new TitleArrayFromResult( $resultWrapper );
-       }
-
        /**
         * @covers TitleArrayFromResult::__construct
         */
@@ -41,7 +37,7 @@ class TitleArrayFromResultTest extends PHPUnit\Framework\TestCase {
                $row = false;
                $resultWrapper = $this->getMockResultWrapper( $row );
 
-               $object = $this->getTitleArrayFromResult( $resultWrapper );
+               $object = new TitleArrayFromResult( $resultWrapper );
 
                $this->assertEquals( $resultWrapper, $object->res );
                $this->assertSame( 0, $object->key );
@@ -57,7 +53,7 @@ class TitleArrayFromResultTest extends PHPUnit\Framework\TestCase {
                $row = $this->getRowWithTitle( $namespace, $title );
                $resultWrapper = $this->getMockResultWrapper( $row );
 
-               $object = $this->getTitleArrayFromResult( $resultWrapper );
+               $object = new TitleArrayFromResult( $resultWrapper );
 
                $this->assertEquals( $resultWrapper, $object->res );
                $this->assertSame( 0, $object->key );
@@ -79,7 +75,7 @@ class TitleArrayFromResultTest extends PHPUnit\Framework\TestCase {
         * @covers TitleArrayFromResult::count
         */
        public function testCountWithVaryingValues( $numRows ) {
-               $object = $this->getTitleArrayFromResult( $this->getMockResultWrapper(
+               $object = new TitleArrayFromResult( $this->getMockResultWrapper(
                        $this->getRowWithTitle(),
                        $numRows
                ) );
@@ -93,7 +89,7 @@ class TitleArrayFromResultTest extends PHPUnit\Framework\TestCase {
                $namespace = 0;
                $title = 'foo';
                $row = $this->getRowWithTitle( $namespace, $title );
-               $object = $this->getTitleArrayFromResult( $this->getMockResultWrapper( $row ) );
+               $object = new TitleArrayFromResult( $this->getMockResultWrapper( $row ) );
                $this->assertInstanceOf( Title::class, $object->current() );
                $this->assertEquals( $namespace, $object->current->mNamespace );
                $this->assertEquals( $title, $object->current->mTextform );
@@ -111,7 +107,7 @@ class TitleArrayFromResultTest extends PHPUnit\Framework\TestCase {
         * @covers TitleArrayFromResult::valid
         */
        public function testValid( $input, $expected ) {
-               $object = $this->getTitleArrayFromResult( $this->getMockResultWrapper( $input ) );
+               $object = new TitleArrayFromResult( $this->getMockResultWrapper( $input ) );
                $this->assertEquals( $expected, $object->valid() );
        }
 
index 80238ec..0132efc 100644 (file)
@@ -11,10 +11,6 @@ use MediaWiki\MediaWikiServices;
  */
 class ImportTest extends MediaWikiLangTestCase {
 
-       private function getDataSource( $xml ) {
-               return new ImportStringSource( $xml );
-       }
-
        /**
         * @covers WikiImporter
         * @dataProvider getUnknownTagsXML
@@ -23,7 +19,7 @@ class ImportTest extends MediaWikiLangTestCase {
         * @param string $title
         */
        public function testUnknownXMLTags( $xml, $text, $title ) {
-               $source = $this->getDataSource( $xml );
+               $source = new ImportStringSource( $xml );
 
                $importer = new WikiImporter(
                        $source,
@@ -82,7 +78,7 @@ EOF
         * @param string|null $redirectTitle
         */
        public function testHandlePageContainsRedirect( $xml, $redirectTitle ) {
-               $source = $this->getDataSource( $xml );
+               $source = new ImportStringSource( $xml );
 
                $redirect = null;
                $callback = function ( Title $title, ForeignTitle $foreignTitle, $revCount,
@@ -168,7 +164,7 @@ EOF
         * @param array|null $namespaces
         */
        public function testSiteInfoContainsNamespaces( $xml, $namespaces ) {
-               $source = $this->getDataSource( $xml );
+               $source = new ImportStringSource( $xml );
 
                $importNamespaces = null;
                $callback = function ( array $siteinfo, $innerImporter ) use ( &$importNamespaces ) {
@@ -253,7 +249,7 @@ EOF
                $n = ( $assign ? 1 : 0 ) + ( $create ? 2 : 0 );
 
                // phpcs:disable Generic.Files.LineLength
-               $source = $this->getDataSource( <<<EOF
+               $source = new ImportStringSource( <<<EOF
 <mediawiki xmlns="http://www.mediawiki.org/xml/export-0.10/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.10/ http://www.mediawiki.org/xml/export-0.10.xsd" version="0.10" xml:lang="en">
   <page>
     <title>TestImportPage</title>
index beaacec..4cbfe46 100644 (file)
@@ -27,10 +27,6 @@ class UserArrayFromResultTest extends MediaWikiTestCase {
                return $row;
        }
 
-       private function getUserArrayFromResult( $resultWrapper ) {
-               return new UserArrayFromResult( $resultWrapper );
-       }
-
        /**
         * @covers UserArrayFromResult::__construct
         */
@@ -38,7 +34,7 @@ class UserArrayFromResultTest extends MediaWikiTestCase {
                $row = false;
                $resultWrapper = $this->getMockResultWrapper( $row );
 
-               $object = $this->getUserArrayFromResult( $resultWrapper );
+               $object = new UserArrayFromResult( $resultWrapper );
 
                $this->assertEquals( $resultWrapper, $object->res );
                $this->assertSame( 0, $object->key );
@@ -53,7 +49,7 @@ class UserArrayFromResultTest extends MediaWikiTestCase {
                $row = $this->getRowWithUsername( $username );
                $resultWrapper = $this->getMockResultWrapper( $row );
 
-               $object = $this->getUserArrayFromResult( $resultWrapper );
+               $object = new UserArrayFromResult( $resultWrapper );
 
                $this->assertEquals( $resultWrapper, $object->res );
                $this->assertSame( 0, $object->key );
@@ -74,7 +70,7 @@ class UserArrayFromResultTest extends MediaWikiTestCase {
         * @covers UserArrayFromResult::count
         */
        public function testCountWithVaryingValues( $numRows ) {
-               $object = $this->getUserArrayFromResult( $this->getMockResultWrapper(
+               $object = new UserArrayFromResult( $this->getMockResultWrapper(
                        $this->getRowWithUsername(),
                        $numRows
                ) );
@@ -87,7 +83,7 @@ class UserArrayFromResultTest extends MediaWikiTestCase {
        public function testCurrentAfterConstruction() {
                $username = 'addshore';
                $userRow = $this->getRowWithUsername( $username );
-               $object = $this->getUserArrayFromResult( $this->getMockResultWrapper( $userRow ) );
+               $object = new UserArrayFromResult( $this->getMockResultWrapper( $userRow ) );
                $this->assertInstanceOf( User::class, $object->current() );
                $this->assertEquals( $username, $object->current()->mName );
        }
@@ -104,7 +100,7 @@ class UserArrayFromResultTest extends MediaWikiTestCase {
         * @covers UserArrayFromResult::valid
         */
        public function testValid( $input, $expected ) {
-               $object = $this->getUserArrayFromResult( $this->getMockResultWrapper( $input ) );
+               $object = new UserArrayFromResult( $this->getMockResultWrapper( $input ) );
                $this->assertEquals( $expected, $object->valid() );
        }
 
index 4f95fbb..4329867 100644 (file)
@@ -4,7 +4,6 @@
  * Checks that all API query modules, core and extensions, have unique prefixes.
  *
  * @group API
- * @coversNothing
  */
 class ApiPrefixUniquenessTest extends MediaWikiTestCase {
 
index 0d10a20..6b64b40 100644 (file)
@@ -11,7 +11,6 @@ use Wikimedia\TestingAccessWrapper;
  * - do not have inconsistencies in the parameter definitions
  *
  * @group API
- * @coversNothing
  */
 class ApiStructureTest extends MediaWikiTestCase {
 
index 4e1b00a..37babce 100644 (file)
@@ -1,8 +1,5 @@
 <?php
 
-/**
- * @coversNothing
- */
 class AutoLoaderStructureTest extends MediaWikiTestCase {
        /**
         * Assert that there were no classes loaded that are not registered with the AutoLoader.
index 57b063d..2a6575a 100644 (file)
@@ -35,9 +35,6 @@ class AvailableRightsTest extends PHPUnit\Framework\TestCase {
                return $rights;
        }
 
-       /**
-        * @coversNothing
-        */
        public function testAvailableRights() {
                $missingRights = array_diff(
                        $this->getAllVisibleRights(),
@@ -69,8 +66,6 @@ class AvailableRightsTest extends PHPUnit\Framework\TestCase {
         * Test, if for all rights a right- message exist,
         * which is used on Special:ListGroupRights as help text
         * Extensions and core
-        *
-        * @coversNothing
         */
        public function testAllRightsWithMessage() {
                $this->checkMessagesExist( 'right-' );
index c75a9d0..c8bcd60 100644 (file)
@@ -32,7 +32,6 @@ class ContentHandlerSanityTest extends MediaWikiTestCase {
        }
 
        /**
-        * @coversNothing
         * @dataProvider provideHandlers
         * @param ContentHandler $handler
         */
index 9c0a73d..b0c1c8f 100644 (file)
@@ -5,7 +5,6 @@ use Wikimedia\Rdbms\Database;
 
 /**
  * @group Database
- * @coversNothing
  */
 class DatabaseIntegrationTest extends MediaWikiTestCase {
        /**
index dea8f5a..60c97cc 100644 (file)
@@ -19,8 +19,6 @@
 /**
  * Validates all loaded extensions and skins using the ExtensionRegistry
  * against the extension.json schema in the docs/ folder.
- *
- * @coversNothing
  */
 class ExtensionJsonValidationTest extends PHPUnit\Framework\TestCase {
 
index 60ce575..d7f865d 100644 (file)
@@ -1,8 +1,5 @@
 <?php
 
-/**
- * @coversNothing
- */
 class PasswordPolicyStructureTest extends MediaWikiTestCase {
 
        public function provideChecks() {
index f41ab3a..4c34208 100644 (file)
@@ -14,7 +14,6 @@ use Wikimedia\TestingAccessWrapper;
  * @copyright © 2012, Niklas Laxström
  * @copyright © 2012, Santhosh Thottingal
  * @copyright © 2012, Timo Tijhof
- * @coversNothing
  */
 class ResourcesTest extends MediaWikiTestCase {
 
index 026b903..3fa31fe 100644 (file)
@@ -11,7 +11,6 @@ use MediaWiki\MediaWikiServices;
  *
  * @since 1.32
  * @author Addshore
- * @coversNothing
  */
 class SpecialPageFatalTest extends MediaWikiTestCase {
        public function provideSpecialPages() {
index 97bed4c..412ee99 100644 (file)
@@ -9,7 +9,6 @@ class StructureTest extends MediaWikiTestCase {
         * Verify all files that appear to be tests have file names ending in
         * Test.  If the file names do not end in Test, they will not be run.
         * @group medium
-        * @coversNothing
         */
        public function testUnitTestFileNamesEndWithTest() {
                // realpath() also normalizes directory separator on windows for prefix compares