Merge "SpecialChangeEmail: Use vform and remove wrapper"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 18 Sep 2014 20:11:38 +0000 (20:11 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 18 Sep 2014 20:11:38 +0000 (20:11 +0000)
29 files changed:
includes/api/ApiMain.php
tests/phpunit/includes/EditPageTest.php
tests/phpunit/includes/MWTimestampTest.php
tests/phpunit/includes/MessageTest.php
tests/phpunit/includes/SampleTest.php
tests/phpunit/includes/TitleArrayFromResultTest.php
tests/phpunit/includes/TitleTest.php
tests/phpunit/includes/UserArrayFromResultTest.php
tests/phpunit/includes/UserTest.php
tests/phpunit/includes/XmlJsTest.php
tests/phpunit/includes/config/GlobalVarConfigTest.php
tests/phpunit/includes/content/JsonContentTest.php
tests/phpunit/includes/exception/MWExceptionTest.php
tests/phpunit/includes/libs/IPSetTest.php
tests/phpunit/includes/libs/MWMessagePackTest.php
tests/phpunit/includes/media/GIFTest.php
tests/phpunit/includes/media/PNGTest.php
tests/phpunit/includes/media/SVGTest.php
tests/phpunit/includes/normal/CleanUpTest.php
tests/phpunit/includes/parser/TidyTest.php
tests/phpunit/includes/password/BcryptPasswordTest.php
tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php
tests/phpunit/includes/password/PasswordTestCase.php
tests/phpunit/includes/password/Pbkdf2PasswordTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php
tests/phpunit/includes/specials/SpecialMyLanguageTest.php
tests/phpunit/includes/title/MediaWikiPageLinkRendererTest.php
tests/phpunit/includes/title/MediaWikiTitleCodecTest.php
tests/phpunit/includes/upload/UploadStashTest.php

index 0d677b1..bd20b14 100644 (file)
@@ -783,10 +783,12 @@ class ApiMain extends ApiBase {
                                $this->dieUsageMsg( array( 'missingparam', 'token' ) );
                        }
 
-                       if ( array_key_exists(
-                               $module->encodeParamName( 'token' ),
-                               $this->getRequest()->getQueryValues()
-                       ) ) {
+                       if ( !$this->getConfig()->get( 'DebugAPI' ) &&
+                               array_key_exists(
+                                       $module->encodeParamName( 'token' ),
+                                       $this->getRequest()->getQueryValues()
+                               )
+                       ) {
                                $this->dieUsage(
                                        "The '{$module->encodeParamName( 'token' )}' parameter was found in the query string, but must be in the POST body",
                                        'mustposttoken'
index 185ffa4..702fce4 100644 (file)
@@ -180,7 +180,7 @@ class EditPageTest extends MediaWikiLangTestCase {
                return $page;
        }
 
-       public function provideCreatePages() {
+       public static function provideCreatePages() {
                return array(
                        array( 'expected article being created',
                                'EditPageTest_testCreatePage',
index c82dc42..dcb9856 100644 (file)
@@ -29,7 +29,7 @@ class MWTimestampTest extends MediaWikiLangTestCase {
                $this->assertEquals( '1406833268', $timestamp->__toString() );
        }
 
-       public function provideValidTimestampDifferences() {
+       public static function provideValidTimestampDifferences() {
                return array(
                        array( '1406833268', '1406833269', '00 00 00 01' ),
                        array( '1406833268', '1406833329', '00 00 01 01' ),
index c2acec0..f3d2a84 100644 (file)
@@ -34,7 +34,7 @@ class MessageTest extends MediaWikiLangTestCase {
                $this->assertEquals( $expectedLang, $langProperty->getValue( $message ) );
        }
 
-       public function provideConstructor() {
+       public static function provideConstructor() {
                $langDe = Language::factory( 'de' );
                $langEn = Language::factory( 'en' );
 
@@ -45,7 +45,7 @@ class MessageTest extends MediaWikiLangTestCase {
                );
        }
 
-       public function provideTestParams() {
+       public static function provideTestParams() {
                return array(
                        array( array() ),
                        array( array( 'foo' ), 'foo' ),
index 86e8e8b..2585811 100644 (file)
@@ -47,7 +47,7 @@ class TestSample extends MediaWikiLangTestCase {
         * If you want to run a the same test with a variety of data, use a data provider.
         * see: http://www.phpunit.de/manual/3.4/en/writing-tests-for-phpunit.html
         */
-       public function provideTitles() {
+       public static function provideTitles() {
                return array(
                        array( 'Text', NS_MEDIA, 'Media:Text' ),
                        array( 'Text', null, 'Text' ),
index e4c7623..0f7069a 100644 (file)
@@ -64,7 +64,7 @@ class TitleArrayFromResultTest extends MediaWikiTestCase {
                $this->assertEquals( $title, $object->current->mTextform );
        }
 
-       public function provideNumberOfRows() {
+       public static function provideNumberOfRows() {
                return array(
                        array( 0 ),
                        array( 1 ),
index 97f6146..53c22b4 100644 (file)
@@ -39,7 +39,7 @@ class TitleTest extends MediaWikiTestCase {
                }
        }
 
-       public function provideValidSecureAndSplit() {
+       public static function provideValidSecureAndSplit() {
                return array(
                        array( 'Sandbox' ),
                        array( 'A "B"' ),
@@ -76,7 +76,7 @@ class TitleTest extends MediaWikiTestCase {
                );
        }
 
-       public function provideInvalidSecureAndSplit() {
+       public static function provideInvalidSecureAndSplit() {
                return array(
                        array( '' ),
                        array( ':' ),
@@ -288,10 +288,7 @@ class TitleTest extends MediaWikiTestCase {
                }
        }
 
-       /**
-        * Provides test parameter values for testIsValidMoveOperation()
-        */
-       public function dataTestIsValidMoveOperation() {
+       public static function provideTestIsValidMoveOperation() {
                return array(
                        array( 'Test', 'Test', 'selfmove' ),
                        array( 'File:Test.jpg', 'Page', 'imagenocrossnamespace' )
@@ -415,13 +412,6 @@ class TitleTest extends MediaWikiTestCase {
                return $result;
        }
 
-       public static function provideTestIsValidMoveOperation() {
-               return array(
-                       array( 'Test', 'Test', 'selfmove' ),
-                       array( 'File:Test.jpg', 'Page', 'imagenocrossnamespace' )
-               );
-       }
-
        /**
         * @dataProvider provideGetPageViewLanguage
         * @covers Title::getPageViewLanguage
@@ -548,7 +538,7 @@ class TitleTest extends MediaWikiTestCase {
                );
        }
 
-       public function provideNewFromTitleValue() {
+       public static function provideNewFromTitleValue() {
                return array(
                        array( new TitleValue( NS_MAIN, 'Foo' ) ),
                        array( new TitleValue( NS_MAIN, 'Foo', 'bar' ) ),
@@ -568,7 +558,7 @@ class TitleTest extends MediaWikiTestCase {
                $this->assertEquals( $value->getFragment(), $title->getFragment() );
        }
 
-       public function provideGetTitleValue() {
+       public static function provideGetTitleValue() {
                return array(
                        array( 'Foo' ),
                        array( 'Foo#bar' ),
@@ -589,7 +579,7 @@ class TitleTest extends MediaWikiTestCase {
                $this->assertEquals( $title->getFragment(), $value->getFragment() );
        }
 
-       public function provideGetFragment() {
+       public static function provideGetFragment() {
                return array(
                        array( 'Foo', '' ),
                        array( 'Foo#bar', 'bar' ),
@@ -629,7 +619,7 @@ class TitleTest extends MediaWikiTestCase {
                $this->assertEquals( $isKnown, $title->isAlwaysKnown() );
        }
 
-       public function provideIsAlwaysKnown() {
+       public static function provideIsAlwaysKnown() {
                return array(
                        array( 'Some nonexistent page', false ),
                        array( 'UTPage', false ),
index ea44f36..62989fa 100644 (file)
@@ -61,7 +61,7 @@ class UserArrayFromResultTest extends MediaWikiTestCase {
                $this->assertEquals( $username, $object->current->mName );
        }
 
-       public function provideNumberOfRows() {
+       public static function provideNumberOfRows() {
                return array(
                        array( 0 ),
                        array( 1 ),
index cabbf10..933fed0 100644 (file)
@@ -338,7 +338,7 @@ class UserTest extends MediaWikiTestCase {
                }
        }
 
-       public function provideGetCanonicalName() {
+       public static function provideGetCanonicalName() {
                return array(
                        array( ' trailing space ', array( 'creatable' => 'Trailing space' ), 'Trailing spaces' ),
                        // @todo FIXME: Maybe the createable name should be 'Talk:Username' or false to reject?
index 907ce79..0dbb010 100644 (file)
@@ -14,7 +14,7 @@ class XmlJs extends MediaWikiTestCase {
                $this->assertEquals( $value, $obj->value );
        }
 
-       public function provideConstruction() {
+       public static function provideConstruction() {
                return array(
                        array( null ),
                        array( '' ),
index 2750196..70b9e68 100644 (file)
@@ -50,7 +50,7 @@ class GlobalVarConfigTest extends MediaWikiTestCase {
                $this->assertFalse( $config->has( 'GlobalVarConfigTestNotHas' ) );
        }
 
-       public function provideGet() {
+       public static function provideGet() {
                $set = array(
                        'wgSomething' => 'default1',
                        'wgFoo' => 'default2',
index 6c77d1a..77b542f 100644 (file)
@@ -15,7 +15,7 @@ class JsonContentTest extends MediaWikiLangTestCase {
                $this->assertEquals( $expected, $obj->getJsonData() );
        }
 
-       public function provideValidConstruction() {
+       public static function provideValidConstruction() {
                return array(
                        array( 'foo', CONTENT_MODEL_JSON, false, null ),
                        array( FormatJson::encode( array() ), CONTENT_MODEL_JSON, true, array() ),
@@ -31,7 +31,7 @@ class JsonContentTest extends MediaWikiLangTestCase {
                $this->assertEquals( FormatJson::encode( $data, true ), $obj->beautifyJSON() );
        }
 
-       public function provideDataToEncode() {
+       public static function provideDataToEncode() {
                return array(
                        array( array() ),
                        array( array( 'foo' ) ),
@@ -74,11 +74,10 @@ class JsonContentTest extends MediaWikiLangTestCase {
                $obj = new JsonContent( FormatJson::encode( $data ) );
                $parserOutput = $obj->getParserOutput( $this->getMockTitle(), null, null, true );
                $this->assertInstanceOf( 'ParserOutput', $parserOutput );
-//             var_dump( $parserOutput->getText(), "\n" );
                $this->assertEquals( $expected, $parserOutput->getText() );
        }
 
-       public function provideDataAndParserText() {
+       public static function provideDataAndParserText() {
                return array(
                        array(
                                array(),
index c45de36..ef0f2a9 100644 (file)
@@ -87,7 +87,7 @@ class MWExceptionTest extends MediaWikiTestCase {
                $this->assertEquals( $expectedReturn, $e->runHooks( $name, $args ) );
        }
 
-       public function provideRunHooks() {
+       public static function provideRunHooks() {
                return array(
                        array( null, null, null, null ),
                        array( array(), 'name', array(), null ),
@@ -134,7 +134,7 @@ class MWExceptionTest extends MediaWikiTestCase {
                $this->assertEquals( $expected, $e->isCommandLine() );
        }
 
-       public function provideIsCommandLine() {
+       public static function provideIsCommandLine() {
                return array(
                        array( false, null ),
                        array( true, true ),
@@ -155,7 +155,7 @@ class MWExceptionTest extends MediaWikiTestCase {
                        "The $exception_class exception should be JSON serializable, got false." );
        }
 
-       public function provideExceptionClasses() {
+       public static function provideExceptionClasses() {
                return array(
                        array( 'Exception' ),
                        array( 'MWException' ),
@@ -192,7 +192,7 @@ class MWExceptionTest extends MediaWikiTestCase {
        /**
         * Returns test cases: exception class, key name, gettype()
         */
-       public function provideJsonSerializedKeys() {
+       public static function provideJsonSerializedKeys() {
                $testCases = array();
                foreach ( array( 'Exception', 'MWException' ) as $exClass ) {
                        $exTests = array(
index aaee512..d4e5214 100644 (file)
@@ -12,7 +12,7 @@ class IPSetTest extends MediaWikiTestCase {
         * config is an array constructor argument for IPSet, and the tests are
         * an array of IP => expected (boolean) result against the config dataset.
         */
-       public function provider() {
+       public static function provideIPSets() {
                return array(
                        array(
                                'old_list_subset',
@@ -240,7 +240,7 @@ class IPSetTest extends MediaWikiTestCase {
         * Validates IPSet loading and matching code
         *
         * @covers IPSet
-        * @dataProvider provider
+        * @dataProvider provideIPSets
         */
        public function testIPSet( $desc, array $cfg, array $tests ) {
                $ipset = new IPSet( $cfg );
index 334d5b5..f80f78d 100644 (file)
@@ -13,7 +13,7 @@ class MWMessagePackTest extends MediaWikiTestCase {
         * using <https://github.com/msgpack/msgpack-php>, which includes a
         * serialization function.
         */
-       public function provider() {
+       public static function providePacks() {
                $tests = array(
                        array( 'nil', null, 'c0' ),
                        array( 'bool', true, 'c3' ),
@@ -66,7 +66,7 @@ class MWMessagePackTest extends MediaWikiTestCase {
        /**
         * Verify that values are serialized correctly.
         * @covers MWMessagePack::pack
-        * @dataProvider provider
+        * @dataProvider providePacks
         */
        public function testPack( $type, $value, $expected ) {
                $actual = bin2hex( MWMessagePack::pack( $value ) );
index 52a51cc..87ffd99 100644 (file)
@@ -116,7 +116,7 @@ class GIFHandlerTest extends MediaWikiMediaTestCase {
                $this->assertEquals( $expected, $actual );
        }
 
-       public function provideGetIndependentMetaArray() {
+       public static function provideGetIndependentMetaArray() {
                return array(
                        array( 'nonanimated.gif', array(
                                'GIFFileComment' => array(
index 092be89..36872a7 100644 (file)
@@ -118,7 +118,7 @@ class PNGHandlerTest extends MediaWikiMediaTestCase {
                $this->assertEquals( $expected, $actual );
        }
 
-       public function provideGetIndependentMetaArray() {
+       public static function provideGetIndependentMetaArray() {
                return array(
                        array( 'rgb-na-png.png', array() ),
                        array( 'xmp.png',
index 1361a92..8f7a0d6 100644 (file)
@@ -28,7 +28,7 @@ class SvgTest extends MediaWikiMediaTestCase {
                $this->assertEquals( $res, $expected );
        }
 
-       public function providerGetIndependentMetaArray() {
+       public static function providerGetIndependentMetaArray() {
                return array(
                        array( 'Tux.svg', array(
                                'ObjectName' => 'Tux',
index 97b76fe..f4b469b 100644 (file)
@@ -110,7 +110,7 @@ class CleanUpTest extends MediaWikiTestCase {
        }
 
        /** @todo document */
-       public function provideAllBytes() {
+       public static function provideAllBytes() {
                return array(
                        array( '', '' ),
                        array( 'x', '' ),
index c869258..f656a74 100644 (file)
@@ -25,7 +25,7 @@ class TidyTest extends MediaWikiTestCase {
                $this->assertEquals( $expected, $text, $msg );
        }
 
-       public function provideTestWrapping() {
+       public static function provideTestWrapping() {
                $testMathML = <<<'MathML'
 <math xmlns="http://www.w3.org/1998/Math/MathML">
     <mrow>
index 4d5c78a..8ac419f 100644 (file)
@@ -11,7 +11,7 @@ class BcryptPasswordTestCase extends PasswordTestCase {
                ) );
        }
 
-       public function providePasswordTests() {
+       public static function providePasswordTests() {
                /** @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong */
                return array(
                        // Tests from glibc bcrypt implementation
index 03a742b..86e8270 100644 (file)
@@ -26,7 +26,7 @@ class LayeredParameterizedPasswordTest extends PasswordTestCase {
                );
        }
 
-       public function providePasswordTests() {
+       public static function providePasswordTests() {
                /** @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong */
                return array(
                        array( true, ':testLargeLayeredTop:sha512:1024:512!sha512:1024:512!sha512:1024:512!sha512:1024:512!5!vnRy+2SrSA0fHt3dwhTP5g==!AVnwfZsAQjn+gULv7FSGjA==!xvHUX3WcpkeSn1lvjWcvBg==!It+OC/N9tu+d3ByHhuB0BQ==!Tb.gqUOiD.aWktVwHM.Q/O!7CcyMfXUPky5ptyATJsR2nq3vUqtnBC', 'testPassword123' ),
index 7820d53..ef16f1c 100644 (file)
@@ -52,7 +52,7 @@ abstract class PasswordTestCase extends MediaWikiTestCase {
         *
         * @return array
         */
-       abstract public function providePasswordTests();
+       abstract public static function providePasswordTests();
 
        /**
         * @dataProvider providePasswordTests
index ae47120..091853e 100644 (file)
@@ -13,7 +13,7 @@ class Pbkdf2PasswordTest extends PasswordTestCase {
                ) );
        }
 
-       public function providePasswordTests() {
+       public static function providePasswordTests() {
                return array(
                        array( true, ":pbkdf2:sha1:1:20:c2FsdA==:DGDID5YfDnHzqbUkr2ASBi/gN6Y=", 'password' ),
                        array( true, ":pbkdf2:sha1:2:20:c2FsdA==:6mwBTcctb4zNHtkqzh1B8NjeiVc=", 'password' ),
index 50f88c8..9dc1805 100644 (file)
@@ -22,7 +22,7 @@ class ResourceLoaderWikiModuleTest extends ResourceLoaderTestCase {
                $this->assertEquals( $expected, $module->isKnownEmpty( $context ) );
        }
 
-       public function provideIsKnownEmpty() {
+       public static function provideIsKnownEmpty() {
                return array(
                        // No valid pages
                        array( array(), 'test1', true ),
index fd09043..4dbfc41 100644 (file)
@@ -53,7 +53,7 @@ class SpecialMyLanguageTest extends MediaWikiTestCase {
                $this->assertEquals( $expected, $title );
        }
 
-       public function provideFindTitle() {
+       public static function provideFindTitle() {
                return array(
                        array( null, '::Fail', 'en', 'en' ),
                        array( 'Page/Another', 'Page/Another/en', 'en', 'en' ),
index 38395c1..4171c10 100644 (file)
@@ -53,7 +53,7 @@ class MediaWikiPageLinkRendererTest extends MediaWikiTestCase {
                return $genderCache;
        }
 
-       public function provideGetPageUrl() {
+       public static function provideGetPageUrl() {
                return array(
                        array(
                                new TitleValue( NS_MAIN, 'Foo_Bar' ),
@@ -86,7 +86,7 @@ class MediaWikiPageLinkRendererTest extends MediaWikiTestCase {
                $this->assertEquals( $url, $actual );
        }
 
-       public function provideRenderHtmlLink() {
+       public static function provideRenderHtmlLink() {
                return array(
                        array(
                                new TitleValue( NS_MAIN, 'Foo_Bar' ),
@@ -128,7 +128,7 @@ class MediaWikiPageLinkRendererTest extends MediaWikiTestCase {
                $this->assertRegExp( $pattern, $actual );
        }
 
-       public function provideRenderWikitextLink() {
+       public static function provideRenderWikitextLink() {
                return array(
                        array(
                                new TitleValue( NS_MAIN, 'Foo_Bar' ),
index bf06e3b..f95b305 100644 (file)
@@ -85,7 +85,7 @@ class MediaWikiTitleCodecTest extends MediaWikiTestCase {
                return new MediaWikiTitleCodec( $lang, $gender );
        }
 
-       public function provideFormat() {
+       public static function provideFormat() {
                return array(
                        array( NS_MAIN, 'Foo_Bar', '', 'en', 'Foo Bar' ),
                        array( NS_USER, 'Hansi_Maier', 'stuff_and_so_on', 'en', 'User:Hansi Maier#stuff and so on' ),
@@ -129,7 +129,7 @@ class MediaWikiTitleCodecTest extends MediaWikiTestCase {
                $this->assertEquals( $normalized, $actual2, 'normalized after round trip' );
        }
 
-       public function provideGetText() {
+       public static function provideGetText() {
                return array(
                        array( NS_MAIN, 'Foo_Bar', '', 'en', 'Foo Bar' ),
                        array( NS_USER, 'Hansi_Maier', 'stuff_and_so_on', 'en', 'Hansi Maier' ),
@@ -148,7 +148,7 @@ class MediaWikiTitleCodecTest extends MediaWikiTestCase {
                $this->assertEquals( $expected, $actual );
        }
 
-       public function provideGetPrefixedText() {
+       public static function provideGetPrefixedText() {
                return array(
                        array( NS_MAIN, 'Foo_Bar', '', 'en', 'Foo Bar' ),
                        array( NS_USER, 'Hansi_Maier', 'stuff_and_so_on', 'en', 'User:Hansi Maier' ),
@@ -174,7 +174,7 @@ class MediaWikiTitleCodecTest extends MediaWikiTestCase {
                $this->assertEquals( $expected, $actual );
        }
 
-       public function provideGetFullText() {
+       public static function provideGetFullText() {
                return array(
                        array( NS_MAIN, 'Foo_Bar', '', 'en', 'Foo Bar' ),
                        array( NS_USER, 'Hansi_Maier', 'stuff_and_so_on', 'en', 'User:Hansi Maier#stuff and so on' ),
@@ -196,7 +196,7 @@ class MediaWikiTitleCodecTest extends MediaWikiTestCase {
                $this->assertEquals( $expected, $actual );
        }
 
-       public function provideParseTitle() {
+       public static function provideParseTitle() {
                //TODO: test capitalization and trimming
                //TODO: test unicode normalization
 
@@ -281,7 +281,7 @@ class MediaWikiTitleCodecTest extends MediaWikiTestCase {
                $this->assertEquals( $title, $actual );
        }
 
-       public function provideParseTitle_invalid() {
+       public static function provideParseTitle_invalid() {
                //TODO: test unicode errors
 
                return array(
@@ -353,7 +353,7 @@ class MediaWikiTitleCodecTest extends MediaWikiTestCase {
                $codec->parseTitle( $text, NS_MAIN );
        }
 
-       public function provideGetNamespaceName() {
+       public static function provideGetNamespaceName() {
                return array(
                        array( NS_MAIN, 'Foo', 'en', '' ),
                        array( NS_USER, 'Foo', 'en', 'User' ),
index fdd40b2..d5d1188 100644 (file)
@@ -68,7 +68,7 @@ class UploadStashTest extends MediaWikiTestCase {
                $stash->removeFile( $file->getFileKey() );
        }
 
-       public function provideInvalidRequests() {
+       public static function provideInvalidRequests() {
                return array(
                        'Check failure on bad wpFileKey' =>
                                array( new FauxRequest( array( 'wpFileKey' => 'foo' ) ) ),
@@ -84,7 +84,7 @@ class UploadStashTest extends MediaWikiTestCase {
                $this->assertFalse( UploadFromStash::isValidRequest( $request ) );
        }
 
-       public function provideValidRequests() {
+       public static function provideValidRequests() {
                return array(
                        'Check good wpFileKey' =>
                                array( new FauxRequest( array( 'wpFileKey' => 'testkey-test.test' ) ) ),