From 791d0b2a98215e46db0f279af4b468f5d28fe4eb Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Fri, 26 Apr 2013 14:00:22 +0200 Subject: [PATCH] Update code formatting Change-Id: I16a9b42651f1cfb1a70dffbb67b7b83dfeb90d03 --- tests/phpunit/MediaWikiPHPUnitCommand.php | 2 - tests/phpunit/MediaWikiTestCase.php | 15 +++--- tests/phpunit/bootstrap.php | 2 +- tests/phpunit/includes/ArticleTablesTest.php | 1 - tests/phpunit/includes/BlockTest.php | 5 +- tests/phpunit/includes/CdbTest.php | 2 +- tests/phpunit/includes/CollationTest.php | 2 + .../phpunit/includes/DiffHistoryBlobTest.php | 3 ++ .../FormOptionsInitializationTest.php | 1 - .../includes/GlobalFunctions/GlobalTest.php | 10 +--- .../GlobalFunctions/GlobalWithDBTest.php | 1 + .../GlobalFunctions/wfAssembleUrlTest.php | 1 - .../GlobalFunctions/wfBaseConvertTest.php | 1 + .../GlobalFunctions/wfExpandUrlTest.php | 1 + .../GlobalFunctions/wfGetCallerTest.php | 1 + .../wfShorthandToIntegerTest.php | 1 - .../GlobalFunctions/wfTimestampTest.php | 1 + tests/phpunit/includes/HooksTest.php | 39 ++++++++++----- tests/phpunit/includes/HtmlTest.php | 3 +- tests/phpunit/includes/HttpTest.php | 1 + .../includes/LanguageConverterTest.php | 1 - tests/phpunit/includes/LinksUpdateTest.php | 2 - tests/phpunit/includes/MWFunctionTest.php | 1 - tests/phpunit/includes/MWNamespaceTest.php | 3 -- tests/phpunit/includes/PathRouterTest.php | 1 - tests/phpunit/includes/PreferencesTest.php | 1 + tests/phpunit/includes/Providers.php | 2 + tests/phpunit/includes/RecentChangeTest.php | 1 - tests/phpunit/includes/RequestContextTest.php | 1 - tests/phpunit/includes/ResourceLoaderTest.php | 5 +- ...evisionStorageTest_ContentHandlerUseDB.php | 1 - tests/phpunit/includes/RevisionTest.php | 2 - tests/phpunit/includes/SanitizerTest.php | 2 - .../includes/SiteConfigurationTest.php | 1 + tests/phpunit/includes/StringUtilsTest.php | 1 + .../includes/TemplateCategoriesTest.php | 1 - tests/phpunit/includes/TestUser.php | 1 - tests/phpunit/includes/TitleMethodsTest.php | 1 - .../phpunit/includes/TitlePermissionTest.php | 6 --- tests/phpunit/includes/TitleTest.php | 1 + tests/phpunit/includes/WikiPageTest.php | 2 +- .../WikiPageTest_ContentHandlerUseDB.php | 1 - .../includes/api/ApiAccountCreationTest.php | 17 ++++--- tests/phpunit/includes/api/ApiOptionsTest.php | 6 +++ tests/phpunit/includes/api/ApiParseTest.php | 1 - tests/phpunit/includes/api/ApiPurgeTest.php | 1 - tests/phpunit/includes/api/ApiTestCase.php | 13 +++-- .../includes/api/ApiTestCaseUpload.php | 4 +- tests/phpunit/includes/api/ApiUploadTest.php | 4 +- .../includes/api/RandomImageGenerator.php | 9 ++-- .../includes/api/format/ApiFormatPhpTest.php | 2 - .../api/query/ApiQueryContinueTestBase.php | 2 + .../includes/api/query/ApiQueryTest.php | 3 -- .../includes/api/query/ApiQueryTestBase.php | 3 +- .../includes/cache/ProcessCacheLRUTest.php | 4 +- .../includes/content/ContentHandlerTest.php | 1 + .../includes/content/CssContentTest.php | 1 - .../content/JavaScriptContentTest.php | 1 - .../includes/content/TextContentTest.php | 1 - .../content/WikitextContentHandlerTest.php | 1 - tests/phpunit/includes/db/DatabaseSQLTest.php | 48 +++++++++---------- .../includes/db/DatabaseSqliteTest.php | 5 ++ .../includes/db/DatabaseTestHelper.php | 2 + tests/phpunit/includes/db/ORMRowTest.php | 1 + tests/phpunit/includes/db/ORMTableTest.php | 2 +- tests/phpunit/includes/db/TestORMRowTest.php | 6 +-- .../includes/filebackend/FileBackendTest.php | 4 ++ .../includes/filerepo/StoreBatchTest.php | 1 + .../includes/jobqueue/JobQueueTest.php | 4 +- .../phpunit/includes/json/FormatJsonTest.php | 2 +- .../includes/libs/GenericArrayObjectTest.php | 3 +- .../media/BitmapMetadataHandlerTest.php | 1 - tests/phpunit/includes/media/ExifTest.php | 2 - tests/phpunit/includes/media/IPTCTest.php | 1 - .../media/PNGMetadataExtractorTest.php | 2 - .../media/SVGMetadataExtractorTest.php | 2 + tests/phpunit/includes/media/XMPTest.php | 2 +- .../includes/media/XMPValidateTest.php | 2 - .../includes/objectcache/BagOStuffTest.php | 1 - .../includes/parser/MediaWikiParserTest.php | 1 + .../phpunit/includes/parser/NewParserTest.php | 6 ++- .../includes/parser/ParserMethodsTest.php | 1 - .../includes/parser/ParserPreloadTest.php | 1 - .../includes/search/SearchEngineTest.php | 2 +- .../includes/search/SearchUpdateTest.php | 1 + .../includes/site/MediaWikiSiteTest.php | 1 - tests/phpunit/includes/site/SiteListTest.php | 1 - .../includes/site/SiteSQLStoreTest.php | 1 - tests/phpunit/includes/site/SiteTest.php | 1 - tests/phpunit/includes/site/TestSites.php | 1 - .../specials/SpecialRecentchangesTest.php | 2 - .../includes/specials/SpecialSearchTest.php | 3 +- .../includes/upload/UploadFromUrlTest.php | 3 +- tests/phpunit/includes/upload/UploadTest.php | 6 +-- .../languages/LanguageClassesTestCase.php | 1 - tests/phpunit/languages/LanguageTest.php | 1 - tests/phpunit/languages/LanguageTrTest.php | 1 - .../utils/CLDRPluralRuleEvaluatorTest.php | 2 +- tests/phpunit/maintenance/DumpTestCase.php | 7 +-- tests/phpunit/maintenance/MaintenanceTest.php | 4 -- .../maintenance/backupPrefetchTest.php | 3 -- .../maintenance/backupTextPassTest.php | 5 +- tests/phpunit/maintenance/backup_LogTest.php | 4 +- tests/phpunit/maintenance/backup_PageTest.php | 4 -- tests/phpunit/maintenance/fetchTextTest.php | 2 - .../maintenance/getSlaveServerTest.php | 2 - tests/phpunit/phpunit.php | 1 - tests/phpunit/resources/ResourcesTest.php | 2 - tests/phpunit/skins/SideBarTest.php | 1 - .../phpunit/suites/UploadFromUrlTestSuite.php | 3 +- 110 files changed, 176 insertions(+), 194 deletions(-) diff --git a/tests/phpunit/MediaWikiPHPUnitCommand.php b/tests/phpunit/MediaWikiPHPUnitCommand.php index 12c2e0035c..b9117fd5a5 100644 --- a/tests/phpunit/MediaWikiPHPUnitCommand.php +++ b/tests/phpunit/MediaWikiPHPUnitCommand.php @@ -18,7 +18,6 @@ class MediaWikiPHPUnitCommand extends PHPUnit_TextUI_Command { foreach ( self::$additionalOptions as $option => $default ) { $this->longOptions[$option] = $option . 'Handler'; } - } public static function main( $exit = true ) { @@ -97,5 +96,4 @@ Database options: EOT; } - } diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index ecc8ad1d47..440f866bf2 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -137,6 +137,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { protected function getNewTempFile() { $fname = tempnam( wfTempDir(), 'MW_PHPUnit_' . get_class( $this ) . '_' ); $this->tmpfiles[] = $fname; + return $fname; } @@ -158,6 +159,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { // where temporary directory creation is bundled and can be improved unlink( $fname ); $this->assertTrue( wfMkdirParents( $fname ) ); + return $fname; } @@ -348,7 +350,8 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { * Stub. If a test needs to add additional data to the database, it should * implement this method and do so */ - function addDBData() {} + function addDBData() { + } private function addCoreDBData() { # disabled for performance @@ -377,7 +380,6 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { 'page_touched' => $this->db->timestamp(), 'page_latest' => 0, 'page_len' => 0 ), __METHOD__, array( 'IGNORE' ) ); - } User::resetIdByNameCache(); @@ -394,7 +396,6 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { $user->saveSettings(); } - //Make 1 page with 1 revision $page = WikiPage::factory( Title::newFromText( 'UTPage' ) ); if ( !$page->getId() == 0 ) { @@ -461,6 +462,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { if ( ( $db->getType() == 'oracle' || !self::$useTemporaryTables ) && self::$reuseDB ) { CloneDatabase::changePrefix( $prefix ); + return; } else { $dbClone->cloneTableStructure(); @@ -523,6 +525,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { private static function unprefixTable( $tableName ) { global $wgDBprefix; + return substr( $tableName, strlen( $wgDBprefix ) ); } @@ -547,6 +550,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { unset( $tables['searchindex_segments'] ); $tables = array_flip( $tables ); } + return $tables; } @@ -561,13 +565,11 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { if ( isset( MediaWikiPHPUnitCommand::$additionalOptions[$offset] ) ) { return MediaWikiPHPUnitCommand::$additionalOptions[$offset]; } - } public function setCliArg( $offset, $value ) { MediaWikiPHPUnitCommand::$additionalOptions[$offset] = $value; - } /** @@ -839,6 +841,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { ) { $wikitextNS = $ns; + return $wikitextNS; } } @@ -906,6 +909,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { if ( !$loaded ) { $this->markTestSkipped( "PHP extension '$extName' is not loaded, skipping." ); } + return $loaded; } @@ -934,5 +938,4 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { $this->assertInstanceOf( $expected, $pokemons, $message ); } - } diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php index 01caf8f478..3978b8df8e 100644 --- a/tests/phpunit/bootstrap.php +++ b/tests/phpunit/bootstrap.php @@ -11,7 +11,7 @@ if ( !defined( 'MW_PHPUNIT_TEST' ) ) { You are running these tests directly from phpunit. You may not have all globals correctly set. Running phpunit.php instead is recommended. EOF; - require_once ( __DIR__ . "/phpunit.php" ); + require_once( __DIR__ . "/phpunit.php" ); } // Output a notice when running with older versions of PHPUnit diff --git a/tests/phpunit/includes/ArticleTablesTest.php b/tests/phpunit/includes/ArticleTablesTest.php index d96a4533c2..686ab93974 100644 --- a/tests/phpunit/includes/ArticleTablesTest.php +++ b/tests/phpunit/includes/ArticleTablesTest.php @@ -29,5 +29,4 @@ class ArticleTablesTest extends MediaWikiLangTestCase { $this->assertEquals( $templates1, $templates2 ); $this->assertEquals( $templates1[0]->getFullText(), 'Historial' ); } - } diff --git a/tests/phpunit/includes/BlockTest.php b/tests/phpunit/includes/BlockTest.php index b0448c0a7f..32fc2c5a8f 100644 --- a/tests/phpunit/includes/BlockTest.php +++ b/tests/phpunit/includes/BlockTest.php @@ -59,7 +59,7 @@ class BlockTest extends MediaWikiLangTestCase { * debug function : dump the ipblocks table */ function dumpBlocks() { - $v = $this->db->select( 'ipblocks', '*' ); + $v = $this->db->select( 'ipblocks', '*' ); print "Got " . $v->numRows() . " rows. Full dump follow:\n"; foreach ( $v as $row ) { print_r( $row ); @@ -72,7 +72,6 @@ class BlockTest extends MediaWikiLangTestCase { $this->assertTrue( $this->block->equals( Block::newFromTarget( 'UTBlockee' ) ), "newFromTarget() returns the same block as the one that was made" ); $this->assertTrue( $this->block->equals( Block::newFromID( $this->blockId ) ), "newFromID() returns the same block as the one that was made" ); - } /** @@ -82,7 +81,6 @@ class BlockTest extends MediaWikiLangTestCase { // delta to stop one-off errors when things happen to go over a second mark. $delta = abs( $this->madeAt - $this->block->mTimestamp ); $this->assertLessThan( 2, $delta, "If no timestamp is specified, the block is recorded as time()" ); - } /** @@ -133,7 +131,6 @@ class BlockTest extends MediaWikiLangTestCase { $u->addToDatabase(); unset( $u ); - // Sanity check $this->assertNull( Block::newFromTarget( $username ), diff --git a/tests/phpunit/includes/CdbTest.php b/tests/phpunit/includes/CdbTest.php index add585d71f..e3d9da7c84 100644 --- a/tests/phpunit/includes/CdbTest.php +++ b/tests/phpunit/includes/CdbTest.php @@ -66,7 +66,6 @@ class CdbTest extends MediaWikiTestCase { $this->cdbAssert( "PHP error", $key, $v1, $value ); $this->cdbAssert( "DBA error", $key, $v2, $value ); } - } private function randomString() { @@ -75,6 +74,7 @@ class CdbTest extends MediaWikiTestCase { for ( $j = 0; $j < $len; $j++ ) { $s .= chr( mt_rand( 0, 255 ) ); } + return $s; } diff --git a/tests/phpunit/includes/CollationTest.php b/tests/phpunit/includes/CollationTest.php index c746208b8f..f1004fbf66 100644 --- a/tests/phpunit/includes/CollationTest.php +++ b/tests/phpunit/includes/CollationTest.php @@ -47,6 +47,7 @@ class CollationTest extends MediaWikiLangTestCase { array( 'en', 'A', 'Aꦲ' ), ); } + /** * Opposite of testIsPrefix * @@ -84,6 +85,7 @@ class CollationTest extends MediaWikiLangTestCase { $col = Collation::factory( $collation ); $this->assertEquals( $firstLetter, $col->getFirstLetter( $string ) ); } + function firstLetterProvider() { return array( array( 'uppercase', 'Abc', 'A' ), diff --git a/tests/phpunit/includes/DiffHistoryBlobTest.php b/tests/phpunit/includes/DiffHistoryBlobTest.php index dcd9dddf4c..53f33d9d27 100644 --- a/tests/phpunit/includes/DiffHistoryBlobTest.php +++ b/tests/phpunit/includes/DiffHistoryBlobTest.php @@ -4,14 +4,17 @@ class DiffHistoryBlobTest extends MediaWikiTestCase { protected function setUp() { if ( !extension_loaded( 'xdiff' ) ) { $this->markTestSkipped( 'The xdiff extension is not available' ); + return; } if ( !function_exists( 'xdiff_string_rabdiff' ) ) { $this->markTestSkipped( 'The version of xdiff extension is lower than 1.5.0' ); + return; } if ( !extension_loaded( 'hash' ) && !extension_loaded( 'mhash' ) ) { $this->markTestSkipped( 'Neither the hash nor mhash extension is available' ); + return; } parent::setUp(); diff --git a/tests/phpunit/includes/FormOptionsInitializationTest.php b/tests/phpunit/includes/FormOptionsInitializationTest.php index 4053683f8e..fb2304dca1 100644 --- a/tests/phpunit/includes/FormOptionsInitializationTest.php +++ b/tests/phpunit/includes/FormOptionsInitializationTest.php @@ -81,5 +81,4 @@ class FormOptionsInitializationTest extends MediaWikiTestCase { $this->object->getOptions() ); } - } diff --git a/tests/phpunit/includes/GlobalFunctions/GlobalTest.php b/tests/phpunit/includes/GlobalFunctions/GlobalTest.php index 2e6417f22c..166a3ce37f 100644 --- a/tests/phpunit/includes/GlobalFunctions/GlobalTest.php +++ b/tests/phpunit/includes/GlobalFunctions/GlobalTest.php @@ -257,7 +257,6 @@ class GlobalTest extends MediaWikiTestCase { $sampleUTF = "Östergötland_coat_of_arms.png"; - //mb_substr $substr_params = array( array( 0, 0 ), @@ -280,7 +279,6 @@ class GlobalTest extends MediaWikiTestCase { ); } - //mb_strlen $this->assertEquals( mb_strlen( $sampleUTF ), @@ -288,7 +286,6 @@ class GlobalTest extends MediaWikiTestCase { 'Fallback mb_strlen' ); - //mb_str(r?)pos $strpos_params = array( //array( 'ter' ), @@ -315,7 +312,6 @@ class GlobalTest extends MediaWikiTestCase { 'Fallback mb_strrpos with params ' . implode( ', ', $old_param_set ) ); } - } @@ -329,7 +325,6 @@ class GlobalTest extends MediaWikiTestCase { $old_wgDebugTimestamps = $wgDebugTimestamps; $wgDebugTimestamps = false; - wfDebug( "This is a normal string" ); $this->assertEquals( "This is a normal string", file_get_contents( $wgDebugLogFile ) ); unlink( $wgDebugLogFile ); @@ -338,7 +333,6 @@ class GlobalTest extends MediaWikiTestCase { $this->assertEquals( "This is nöt an ASCII string", file_get_contents( $wgDebugLogFile ) ); unlink( $wgDebugLogFile ); - wfDebug( "\00305This has böth UTF and control chars\003" ); $this->assertEquals( " 05This has böth UTF and control chars ", file_get_contents( $wgDebugLogFile ) ); unlink( $wgDebugLogFile ); @@ -351,7 +345,6 @@ class GlobalTest extends MediaWikiTestCase { $this->assertGreaterThan( 5000000, preg_replace( '/\D/', '', file_get_contents( $wgDebugLogFile ) ) ); unlink( $wgDebugLogFile ); - $wgDebugLogFile = $old_log_file; $wgDebugTimestamps = $old_wgDebugTimestamps; } @@ -398,7 +391,6 @@ class GlobalTest extends MediaWikiTestCase { $this->assertEquals( $var1, 2, 'var1 is swapped' ); $this->assertEquals( $var2, 1, 'var2 is swapped' ); - } function testWfPercentTest() { @@ -643,6 +635,7 @@ class GlobalTest extends MediaWikiTestCase { array( "$p//nds-nl.wikipedia.org", array( 'nl.wikipedia.org' ), true, "Substrings of domains match while they shouldn't, $pDesc URL" ), ) ); } + return $a; } @@ -660,6 +653,7 @@ class GlobalTest extends MediaWikiTestCase { public static function provideWfShellMaintenanceCmdList() { global $wgPhpCli; + return array( array( 'eval.php', array( '--help', '--test' ), array(), "'$wgPhpCli' 'eval.php' '--help' '--test'", diff --git a/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php b/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php index c585726454..8bd0849b26 100644 --- a/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php +++ b/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php @@ -13,6 +13,7 @@ class GlobalWithDBTest extends MediaWikiTestCase { public static function provideWfIsBadImageList() { $blacklist = '* [[File:Bad.jpg]] except [[Nasty page]]'; + return array( array( 'Bad.jpg', false, $blacklist, true, 'Called on a bad image' ), diff --git a/tests/phpunit/includes/GlobalFunctions/wfAssembleUrlTest.php b/tests/phpunit/includes/GlobalFunctions/wfAssembleUrlTest.php index 4bd8c6852a..4184d1524f 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfAssembleUrlTest.php +++ b/tests/phpunit/includes/GlobalFunctions/wfAssembleUrlTest.php @@ -87,7 +87,6 @@ class WfAssembleUrlTest extends MediaWikiTestCase { $url .= '#' . $fragment; } - $cases[] = array( $parts, $url, diff --git a/tests/phpunit/includes/GlobalFunctions/wfBaseConvertTest.php b/tests/phpunit/includes/GlobalFunctions/wfBaseConvertTest.php index 10b62b3c36..c60f22386d 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfBaseConvertTest.php +++ b/tests/phpunit/includes/GlobalFunctions/wfBaseConvertTest.php @@ -152,6 +152,7 @@ class WfBaseConvertTest extends MediaWikiTestCase { $x[] = array( $base, $str ); } + return $x; } diff --git a/tests/phpunit/includes/GlobalFunctions/wfExpandUrlTest.php b/tests/phpunit/includes/GlobalFunctions/wfExpandUrlTest.php index 8c67ced402..5b622c11bf 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfExpandUrlTest.php +++ b/tests/phpunit/includes/GlobalFunctions/wfExpandUrlTest.php @@ -103,6 +103,7 @@ class WfExpandUrlTest extends MediaWikiTestCase { } } } + return $retval; } } diff --git a/tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php b/tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php index 87193faee3..3521d18a4b 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php +++ b/tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php @@ -18,6 +18,7 @@ class WfGetCallerTest extends MediaWikiTestCase { if ( $n > 0 ) { return self::intermediateFunction( $level, $n - 1 ); } + return wfGetCaller( $level ); } diff --git a/tests/phpunit/includes/GlobalFunctions/wfShorthandToIntegerTest.php b/tests/phpunit/includes/GlobalFunctions/wfShorthandToIntegerTest.php index e4e33d1ca0..604f901479 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfShorthandToIntegerTest.php +++ b/tests/phpunit/includes/GlobalFunctions/wfShorthandToIntegerTest.php @@ -24,5 +24,4 @@ class WfShorthandToIntegerTest extends MediaWikiTestCase { array( '1k', 1024, 'One kb lowercased' ), ); } - } diff --git a/tests/phpunit/includes/GlobalFunctions/wfTimestampTest.php b/tests/phpunit/includes/GlobalFunctions/wfTimestampTest.php index ddfffe8232..3ac33a4017 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfTimestampTest.php +++ b/tests/phpunit/includes/GlobalFunctions/wfTimestampTest.php @@ -12,6 +12,7 @@ class WfTimestampTest extends MediaWikiTestCase { public static function provideNormalTimestamps() { $t = gmmktime( 12, 34, 56, 1, 15, 2001 ); + return array( // TS_UNIX array( $t, TS_MW, '20010115123456', 'TS_UNIX to TS_MW' ), diff --git a/tests/phpunit/includes/HooksTest.php b/tests/phpunit/includes/HooksTest.php index 8f70b3dfc0..81dd48704a 100644 --- a/tests/phpunit/includes/HooksTest.php +++ b/tests/phpunit/includes/HooksTest.php @@ -11,6 +11,7 @@ class HooksTest extends MediaWikiTestCase { public static function provideHooks() { $i = new NothingClass(); + return array( array( 'Object and method', array( $i, 'someNonStatic' ), 'changed-nonstatic', 'changed-nonstatic' ), array( 'Object and no method', array( $i ), 'changed-onevent', 'original' ), @@ -19,14 +20,16 @@ class HooksTest extends MediaWikiTestCase { array( 'Class::method static call', array( 'NothingClass::someStatic' ), 'changed-static', 'original' ), array( 'Global function', array( 'NothingFunction' ), 'changed-func', 'original' ), array( 'Global function with data', array( 'NothingFunctionData', 'data' ), 'data', 'original' ), - array( 'Closure', array( function( &$foo, $bar ) { - $foo = 'changed-closure'; - return true; - } ), 'changed-closure', 'original' ), - array( 'Closure with data', array( function( $data, &$foo, $bar ) { - $foo = $data; - return true; - }, 'data' ), 'data', 'original' ) + array( 'Closure', array( function ( &$foo, $bar ) { + $foo = 'changed-closure'; + + return true; + } ), 'changed-closure', 'original' ), + array( 'Closure with data', array( function ( $data, &$foo, $bar ) { + $foo = $data; + + return true; + }, 'data' ), 'data', 'original' ) ); } @@ -86,8 +89,14 @@ class HooksTest extends MediaWikiTestCase { } public function testFalseReturn() { - Hooks::register( 'MediaWikiHooksTest001', function( &$foo ) { return false; } ); - Hooks::register( 'MediaWikiHooksTest001', function( &$foo ) { $foo = 'test'; return true; } ); + Hooks::register( 'MediaWikiHooksTest001', function ( &$foo ) { + return false; + } ); + Hooks::register( 'MediaWikiHooksTest001', function ( &$foo ) { + $foo = 'test'; + + return true; + } ); $foo = 'original'; Hooks::run( 'MediaWikiHooksTest001', array( &$foo ) ); $this->assertSame( 'original', $foo, 'Hooks continued processing after a false return.' ); @@ -97,18 +106,22 @@ class HooksTest extends MediaWikiTestCase { * @expectedException FatalError */ public function testFatalError() { - Hooks::register( 'MediaWikiHooksTest001', function() { return 'test'; } ); + Hooks::register( 'MediaWikiHooksTest001', function () { + return 'test'; + } ); Hooks::run( 'MediaWikiHooksTest001', array() ); } } function NothingFunction( &$foo, &$bar ) { $foo = 'changed-func'; + return true; } function NothingFunctionData( $data, &$foo, &$bar ) { $foo = $data; + return true; } @@ -117,6 +130,7 @@ class NothingClass { public static function someStatic( &$foo, &$bar ) { $foo = 'changed-static'; + return true; } @@ -124,18 +138,21 @@ class NothingClass { $this->calls++; $foo = 'changed-nonstatic'; $bar = 'changed-nonstatic'; + return true; } public function onMediaWikiHooksTest001( &$foo, &$bar ) { $this->calls++; $foo = 'changed-onevent'; + return true; } public function someNonStaticWithData( $data, &$foo, &$bar ) { $this->calls++; $foo = $data; + return true; } } diff --git a/tests/phpunit/includes/HtmlTest.php b/tests/phpunit/includes/HtmlTest.php index 9e3d3a4638..4e010d42a3 100644 --- a/tests/phpunit/includes/HtmlTest.php +++ b/tests/phpunit/includes/HtmlTest.php @@ -432,6 +432,7 @@ class HtmlTest extends MediaWikiTestCase { foreach ( $types as $type ) { $cases[] = array( $type ); } + return $cases; } @@ -596,6 +597,7 @@ class HtmlTest extends MediaWikiTestCase { isset( $case[3] ) ? $case[3] : '' ); } + return $ret; } @@ -610,5 +612,4 @@ class HtmlTest extends MediaWikiTestCase { 'Allow special case "step=any".' ); } - } diff --git a/tests/phpunit/includes/HttpTest.php b/tests/phpunit/includes/HttpTest.php index 7698776c74..12ba22612c 100644 --- a/tests/phpunit/includes/HttpTest.php +++ b/tests/phpunit/includes/HttpTest.php @@ -194,6 +194,7 @@ class MWHttpRequestTester extends MWHttpRequest { throw new MWException( __METHOD__ . ': allow_url_fopen needs to be enabled for pure PHP' . ' http requests to work. If possible, curl should be used instead. See http://php.net/curl.' ); } + return new PhpHttpRequestTester( $url, $options ); default: } diff --git a/tests/phpunit/includes/LanguageConverterTest.php b/tests/phpunit/includes/LanguageConverterTest.php index ab93b2b6e9..93ce1195a1 100644 --- a/tests/phpunit/includes/LanguageConverterTest.php +++ b/tests/phpunit/includes/LanguageConverterTest.php @@ -123,7 +123,6 @@ class TestConverter extends LanguageConverter { 'tg' => new ReplacementArray() ); } - } class LanguageToTest extends Language { diff --git a/tests/phpunit/includes/LinksUpdateTest.php b/tests/phpunit/includes/LinksUpdateTest.php index c83f7dac45..ae551c00e5 100644 --- a/tests/phpunit/includes/LinksUpdateTest.php +++ b/tests/phpunit/includes/LinksUpdateTest.php @@ -122,7 +122,6 @@ class LinksUpdateTest extends MediaWikiTestCase { $po->addImage( "Foo.png" ); - $this->assertLinksUpdate( $t, $po, 'imagelinks', 'il_to', 'il_from = 111', array( array( 'Foo.png' ), ) ); @@ -133,7 +132,6 @@ class LinksUpdateTest extends MediaWikiTestCase { $po->addLanguageLink( Title::newFromText( "en:Foo" )->getFullText() ); - $this->assertLinksUpdate( $t, $po, 'langlinks', 'll_lang, ll_title', 'll_from = 111', array( array( 'En', 'Foo' ), ) ); diff --git a/tests/phpunit/includes/MWFunctionTest.php b/tests/phpunit/includes/MWFunctionTest.php index 6c17bf4856..becf5075ee 100644 --- a/tests/phpunit/includes/MWFunctionTest.php +++ b/tests/phpunit/includes/MWFunctionTest.php @@ -59,7 +59,6 @@ class MWFunctionTest extends MediaWikiTestCase { public static function someMethod() { return func_get_args(); } - } class MWBlankClass { diff --git a/tests/phpunit/includes/MWNamespaceTest.php b/tests/phpunit/includes/MWNamespaceTest.php index 6b71b7e2b4..7d6d5a1f51 100644 --- a/tests/phpunit/includes/MWNamespaceTest.php +++ b/tests/phpunit/includes/MWNamespaceTest.php @@ -125,7 +125,6 @@ class MWNamespaceTest extends MediaWikiTestCase { public function testGetAssociated() { $this->assertEquals( NS_TALK, MWNamespace::getAssociated( NS_MAIN ) ); $this->assertEquals( NS_MAIN, MWNamespace::getAssociated( NS_TALK ) ); - } ### Exceptions with getAssociated() @@ -201,7 +200,6 @@ class MWNamespaceTest extends MediaWikiTestCase { NS_SPECIAL, NS_MEDIA, "NS_SPECIAL and NS_MEDIA are different subject namespaces" ); - } /** @@ -350,7 +348,6 @@ class MWNamespaceTest extends MediaWikiTestCase { '$wgContentNamespaces is an array with only NS_MAIN by default' ); - # test !is_array( $wgcontentNamespaces ) $wgContentNamespaces = ''; $this->assertEquals( NS_MAIN, MWNamespace::getContentNamespaces() ); diff --git a/tests/phpunit/includes/PathRouterTest.php b/tests/phpunit/includes/PathRouterTest.php index 9e50b4c251..386ddb8cf5 100644 --- a/tests/phpunit/includes/PathRouterTest.php +++ b/tests/phpunit/includes/PathRouterTest.php @@ -253,5 +253,4 @@ class PathRouterTest extends MediaWikiTestCase { $matches = $router->parse( "/wiki/Foo" ); $this->assertEquals( $matches, array( 'title' => 'bar%20$1' ) ); } - } diff --git a/tests/phpunit/includes/PreferencesTest.php b/tests/phpunit/includes/PreferencesTest.php index 7aa3c4a47a..b909f26b38 100644 --- a/tests/phpunit/includes/PreferencesTest.php +++ b/tests/phpunit/includes/PreferencesTest.php @@ -77,6 +77,7 @@ class PreferencesTest extends MediaWikiTestCase { , $this->context , $preferences ); + return $preferences; } } diff --git a/tests/phpunit/includes/Providers.php b/tests/phpunit/includes/Providers.php index 948b635461..4ddc0b049f 100644 --- a/tests/phpunit/includes/Providers.php +++ b/tests/phpunit/includes/Providers.php @@ -16,6 +16,7 @@ class MediaWikiProvide { for ( $i = 1; $i <= $num; $i++ ) { $ret[] = array( $i ); } + return $ret; } @@ -39,6 +40,7 @@ class MediaWikiProvide { $ret[] = array( $day[0], $month[0] ); } } + return $ret; } } diff --git a/tests/phpunit/includes/RecentChangeTest.php b/tests/phpunit/includes/RecentChangeTest.php index a1e623630e..56967de947 100644 --- a/tests/phpunit/includes/RecentChangeTest.php +++ b/tests/phpunit/includes/RecentChangeTest.php @@ -276,5 +276,4 @@ class RecentChangeTest extends MediaWikiTestCase { $msg ); } - } diff --git a/tests/phpunit/includes/RequestContextTest.php b/tests/phpunit/includes/RequestContextTest.php index f5871716ae..7aebf2c765 100644 --- a/tests/phpunit/includes/RequestContextTest.php +++ b/tests/phpunit/includes/RequestContextTest.php @@ -25,7 +25,6 @@ class RequestContextTest extends MediaWikiTestCase { $context->setTitle( $curTitle ); $this->assertTrue( $curTitle->equals( $context->getWikiPage()->getTitle() ), "When a title is updated the WikiPage should be purged and recreated on-demand with the new title." ); - } public function testImportScopedSession() { diff --git a/tests/phpunit/includes/ResourceLoaderTest.php b/tests/phpunit/includes/ResourceLoaderTest.php index 60618b1010..68db9add18 100644 --- a/tests/phpunit/includes/ResourceLoaderTest.php +++ b/tests/phpunit/includes/ResourceLoaderTest.php @@ -11,6 +11,7 @@ class ResourceLoaderTest extends MediaWikiTestCase { */ public static function resourceLoaderRegisterModules( &$resourceLoader ) { self::$resourceLoaderRegisterModulesHook = true; + return true; } @@ -31,6 +32,7 @@ class ResourceLoaderTest extends MediaWikiTestCase { self::$resourceLoaderRegisterModulesHook = false; $resourceLoader = new ResourceLoader(); $this->assertTrue( self::$resourceLoaderRegisterModulesHook ); + return $resourceLoader; } @@ -84,7 +86,8 @@ class ResourceLoaderTest extends MediaWikiTestCase { /* Stubs */ -class ResourceLoaderTestModule extends ResourceLoaderModule {} +class ResourceLoaderTestModule extends ResourceLoaderModule { +} /* Hooks */ global $wgHooks; diff --git a/tests/phpunit/includes/RevisionStorageTest_ContentHandlerUseDB.php b/tests/phpunit/includes/RevisionStorageTest_ContentHandlerUseDB.php index 39673c0318..968aabae97 100644 --- a/tests/phpunit/includes/RevisionStorageTest_ContentHandlerUseDB.php +++ b/tests/phpunit/includes/RevisionStorageTest_ContentHandlerUseDB.php @@ -78,5 +78,4 @@ class RevisionTest_ContentHandlerUseDB extends RevisionStorageTest { $this->assertTrue( true ); // ok } } - } diff --git a/tests/phpunit/includes/RevisionTest.php b/tests/phpunit/includes/RevisionTest.php index 9380928d6e..e3b0844ebf 100644 --- a/tests/phpunit/includes/RevisionTest.php +++ b/tests/phpunit/includes/RevisionTest.php @@ -403,7 +403,6 @@ class RevisionTest extends MediaWikiTestCase { // for immutable content like wikitext, this should be the same object $this->assertSame( $content, $content2 ); } - } class RevisionTestModifyableContent extends TextContent { @@ -422,7 +421,6 @@ class RevisionTestModifyableContent extends TextContent { public function setText( $text ) { $this->mText = $text; } - } class RevisionTestModifyableContentHandler extends TextContentHandler { diff --git a/tests/phpunit/includes/SanitizerTest.php b/tests/phpunit/includes/SanitizerTest.php index f5aacabe8e..c84f10c9b7 100644 --- a/tests/phpunit/includes/SanitizerTest.php +++ b/tests/phpunit/includes/SanitizerTest.php @@ -148,7 +148,6 @@ class SanitizerTest extends MediaWikiTestCase { array( array( 'foo.' => 'baz' ), 'foo.=baz', 'A . is allowed as last character' ), array( array( 'foo6' => 'baz' ), 'foo6=baz', 'Numbers are allowed' ), - # This bit is more relaxed than XML rules, but some extensions use # it, like ProofreadPage (see bug 27539) array( array( '1foo' => 'baz' ), '1foo=baz', 'Leading numbers are allowed' ), @@ -246,5 +245,4 @@ class SanitizerTest extends MediaWikiTestCase { $message ); } - } diff --git a/tests/phpunit/includes/SiteConfigurationTest.php b/tests/phpunit/includes/SiteConfigurationTest.php index fc7d8d09e9..4cdf0201be 100644 --- a/tests/phpunit/includes/SiteConfigurationTest.php +++ b/tests/phpunit/includes/SiteConfigurationTest.php @@ -10,6 +10,7 @@ function getSiteParams( $conf, $wiki ) { break; } } + return array( 'suffix' => $site, 'lang' => $lang, diff --git a/tests/phpunit/includes/StringUtilsTest.php b/tests/phpunit/includes/StringUtilsTest.php index 0530b4490c..842e2fc431 100644 --- a/tests/phpunit/includes/StringUtilsTest.php +++ b/tests/phpunit/includes/StringUtilsTest.php @@ -49,6 +49,7 @@ class StringUtilsTest extends MediaWikiTestCase { $escaped .= $char; } } + return $escaped; } diff --git a/tests/phpunit/includes/TemplateCategoriesTest.php b/tests/phpunit/includes/TemplateCategoriesTest.php index fc15d02872..ffa8c428b3 100644 --- a/tests/phpunit/includes/TemplateCategoriesTest.php +++ b/tests/phpunit/includes/TemplateCategoriesTest.php @@ -33,5 +33,4 @@ class TemplateCategoriesTest extends MediaWikiLangTestCase { , $title->getParentCategories() ); } - } diff --git a/tests/phpunit/includes/TestUser.php b/tests/phpunit/includes/TestUser.php index c4d8945557..2fb0f499c5 100644 --- a/tests/phpunit/includes/TestUser.php +++ b/tests/phpunit/includes/TestUser.php @@ -53,6 +53,5 @@ class TestUser { } } $this->user->saveSettings(); - } } diff --git a/tests/phpunit/includes/TitleMethodsTest.php b/tests/phpunit/includes/TitleMethodsTest.php index 476c194684..a11c3d9802 100644 --- a/tests/phpunit/includes/TitleMethodsTest.php +++ b/tests/phpunit/includes/TitleMethodsTest.php @@ -286,5 +286,4 @@ class TitleMethodsTest extends MediaWikiTestCase { $title = Title::newFromText( $title ); $this->assertEquals( $expectedBool, $title->isWikitextPage() ); } - } diff --git a/tests/phpunit/includes/TitlePermissionTest.php b/tests/phpunit/includes/TitlePermissionTest.php index aaf81f6b86..b8b0391f86 100644 --- a/tests/phpunit/includes/TitlePermissionTest.php +++ b/tests/phpunit/includes/TitlePermissionTest.php @@ -66,7 +66,6 @@ class TitlePermissionTest extends MediaWikiLangTestCase { $this->user = $this->userUser; } - } function setUserPerm( $perm ) { @@ -317,7 +316,6 @@ class TitlePermissionTest extends MediaWikiLangTestCase { $this->title->userCan( $action, $this->user, true ) ); $this->assertEquals( $check[$action][3], $this->title->quickUserCan( $action, $this->user ) ); - # count( User::getGroupsWithPermissions( $action ) ) < 1 } } @@ -538,7 +536,6 @@ class TitlePermissionTest extends MediaWikiLangTestCase { $this->title->userCan( 'edit', $this->user ) ); $this->assertEquals( array(), $this->title->getUserPermissionsErrors( 'edit', $this->user ) ); - } function testActionPermissions() { @@ -562,7 +559,6 @@ class TitlePermissionTest extends MediaWikiLangTestCase { $this->assertEquals( true, $this->title->userCan( 'create', $this->user ) ); - $this->setUserPerm( array( 'createpage' ) ); $this->assertEquals( array( array( 'titleprotected', 'Useruser', 'test' ) ), $this->title->getUserPermissionsErrors( 'create', $this->user ) ); @@ -605,7 +601,6 @@ class TitlePermissionTest extends MediaWikiLangTestCase { $this->title->getUserPermissionsErrors( 'move-target', $this->user ) ); $this->assertEquals( false, $this->title->userCan( 'move-target', $this->user ) ); - } function testUserBlock() { @@ -655,7 +650,6 @@ class TitlePermissionTest extends MediaWikiLangTestCase { 'Useruser', null, '23:00, 31 December 1969', '127.0.8.1', $wgLang->timeanddate( wfTimestamp( TS_MW, $now ), true ) ) ), $this->title->getUserPermissionsErrors( 'move-target', $this->user ) ); - # $action != 'read' && $action != 'createaccount' && $user->isBlockedFrom( $this ) # $user->blockedFor() == '' # $user->mBlock->mExpiry == 'infinity' diff --git a/tests/phpunit/includes/TitleTest.php b/tests/phpunit/includes/TitleTest.php index 970862b1e7..33bd8d6ebd 100644 --- a/tests/phpunit/includes/TitleTest.php +++ b/tests/phpunit/includes/TitleTest.php @@ -197,6 +197,7 @@ class TitleTest extends MediaWikiTestCase { foreach ( $errors as $error ) { $result[] = $error[0]; } + return $result; } diff --git a/tests/phpunit/includes/WikiPageTest.php b/tests/phpunit/includes/WikiPageTest.php index 4bb6daa314..f829509f77 100644 --- a/tests/phpunit/includes/WikiPageTest.php +++ b/tests/phpunit/includes/WikiPageTest.php @@ -587,6 +587,7 @@ class WikiPageTest extends MediaWikiLangTestCase { $text = preg_replace( '!\s*(

)!sm', '\1', $text ); # don't let tidy confuse us $this->assertEquals( $expectedHtml, $text ); + return $po; } @@ -1014,5 +1015,4 @@ more stuff $this->assertEquals( $expected, $text ); } - } diff --git a/tests/phpunit/includes/WikiPageTest_ContentHandlerUseDB.php b/tests/phpunit/includes/WikiPageTest_ContentHandlerUseDB.php index dca9910a35..41f3572efd 100644 --- a/tests/phpunit/includes/WikiPageTest_ContentHandlerUseDB.php +++ b/tests/phpunit/includes/WikiPageTest_ContentHandlerUseDB.php @@ -44,5 +44,4 @@ class WikiPageTest_ContentHandlerUseDB extends WikiPageTest { $page = new WikiPage( $page->getTitle() ); $this->assertEquals( 'WikitextContentHandler', get_class( $page->getContentHandler() ) ); } - } diff --git a/tests/phpunit/includes/api/ApiAccountCreationTest.php b/tests/phpunit/includes/api/ApiAccountCreationTest.php index 02c03a01a3..50638ca716 100644 --- a/tests/phpunit/includes/api/ApiAccountCreationTest.php +++ b/tests/phpunit/includes/api/ApiAccountCreationTest.php @@ -47,13 +47,16 @@ class ApiCreateAccountTest extends ApiTestCase { $token = $a['token']; // Finally create the account - $ret = $this->doApiRequest( array( - 'action' => 'createaccount', - 'name' => 'Apitestnew', - 'password' => $password, - 'token' => $token, - 'email' => 'test@domain.test', - 'realname' => 'Test Name' ), $ret[2] + $ret = $this->doApiRequest( + array( + 'action' => 'createaccount', + 'name' => 'Apitestnew', + 'password' => $password, + 'token' => $token, + 'email' => 'test@domain.test', + 'realname' => 'Test Name' + ), + $ret[2] ); $result = $ret[0]; diff --git a/tests/phpunit/includes/api/ApiOptionsTest.php b/tests/phpunit/includes/api/ApiOptionsTest.php index 902b7b8550..ae74e384a1 100644 --- a/tests/phpunit/includes/api/ApiOptionsTest.php +++ b/tests/phpunit/includes/api/ApiOptionsTest.php @@ -116,6 +116,7 @@ class ApiOptionsTest extends MediaWikiLangTestCase { $mapping[$key] = 'unused'; } } + return $mapping; } @@ -126,12 +127,14 @@ class ApiOptionsTest extends MediaWikiLangTestCase { 'optionname' => null, 'optionvalue' => null, ); + return array_merge( $request, $custom ); } private function executeQuery( $request ) { $this->mContext->setRequest( new FauxRequest( $request, true, $this->mSession ) ); $this->mTested->execute(); + return $this->mTested->getResult()->getData(); } @@ -156,6 +159,7 @@ class ApiOptionsTest extends MediaWikiLangTestCase { } catch ( UsageException $e ) { $this->assertEquals( 'notloggedin', $e->getCodeString() ); $this->assertEquals( 'Anonymous users cannot change preferences', $e->getMessage() ); + return; } $this->fail( "UsageException was not thrown" ); @@ -169,6 +173,7 @@ class ApiOptionsTest extends MediaWikiLangTestCase { } catch ( UsageException $e ) { $this->assertEquals( 'nooptionname', $e->getCodeString() ); $this->assertEquals( 'The optionname parameter must be set', $e->getMessage() ); + return; } $this->fail( "UsageException was not thrown" ); @@ -191,6 +196,7 @@ class ApiOptionsTest extends MediaWikiLangTestCase { } catch ( UsageException $e ) { $this->assertEquals( 'nochanges', $e->getCodeString() ); $this->assertEquals( 'No changes were requested', $e->getMessage() ); + return; } $this->fail( "UsageException was not thrown" ); diff --git a/tests/phpunit/includes/api/ApiParseTest.php b/tests/phpunit/includes/api/ApiParseTest.php index 475a2adf93..b408875c23 100644 --- a/tests/phpunit/includes/api/ApiParseTest.php +++ b/tests/phpunit/includes/api/ApiParseTest.php @@ -26,5 +26,4 @@ class ApiParseTest extends ApiTestCase { "Parse request for nonexistent page must give 'missingtitle' error: " . var_export( $ex->getMessageArray(), true ) ); } } - } diff --git a/tests/phpunit/includes/api/ApiPurgeTest.php b/tests/phpunit/includes/api/ApiPurgeTest.php index a7f9229d03..881eb3f2f2 100644 --- a/tests/phpunit/includes/api/ApiPurgeTest.php +++ b/tests/phpunit/includes/api/ApiPurgeTest.php @@ -37,5 +37,4 @@ class ApiPurgeTest extends ApiTestCase { $this->assertArrayHasKey( $pages[$v['title']], $v ); } } - } diff --git a/tests/phpunit/includes/api/ApiTestCase.php b/tests/phpunit/includes/api/ApiTestCase.php index 552fbfbfb5..1559bef103 100644 --- a/tests/phpunit/includes/api/ApiTestCase.php +++ b/tests/phpunit/includes/api/ApiTestCase.php @@ -52,6 +52,7 @@ abstract class ApiTestCase extends MediaWikiLangTestCase { protected function editPage( $pageName, $text, $summary = '', $defaultNs = NS_MAIN ) { $title = Title::newFromText( $pageName, $defaultNs ); $page = WikiPage::factory( $title ); + return $page->doEditContent( ContentHandler::makeContent( $text, $title ), $summary ); } @@ -131,6 +132,7 @@ abstract class ApiTestCase extends MediaWikiLangTestCase { $session['wsEditToken'] = $session['wsToken']; // add token to request parameters $params['token'] = md5( $session['wsToken'] ) . User::EDIT_TOKEN_SUFFIX; + return $this->doApiRequest( $params, $session, false, $user ); } else { throw new Exception( "request data not in right format" ); @@ -164,6 +166,7 @@ abstract class ApiTestCase extends MediaWikiLangTestCase { 'titles' => 'Main Page', 'intoken' => 'edit|delete|protect|move|block|unblock|watch', 'prop' => 'info' ), $session, false, $user->user ); + return $data; } @@ -204,11 +207,14 @@ class UserWrapper { } class MockApi extends ApiBase { - public function execute() {} + public function execute() { + } - public function getVersion() {} + public function getVersion() { + } - public function __construct() {} + public function __construct() { + } public function getAllowedParams() { return array( @@ -234,6 +240,7 @@ class ApiTestContext extends RequestContext { if ( $user !== null ) { $context->setUser( $user ); } + return $context; } } diff --git a/tests/phpunit/includes/api/ApiTestCaseUpload.php b/tests/phpunit/includes/api/ApiTestCaseUpload.php index 802849177c..7e18b6ede0 100644 --- a/tests/phpunit/includes/api/ApiTestCaseUpload.php +++ b/tests/phpunit/includes/api/ApiTestCaseUpload.php @@ -47,6 +47,7 @@ abstract class ApiTestCaseUpload extends ApiTestCase { // see if it now doesn't exist; reload $title = Title::newFromText( $title->getText(), NS_FILE ); } + return !( $title && $title instanceof Title && $title->exists() ); } @@ -69,6 +70,7 @@ abstract class ApiTestCaseUpload extends ApiTestCase { foreach ( $dupes as $dupe ) { $success &= $this->deleteFileByTitle( $dupe->getTitle() ); } + return $success; } @@ -105,7 +107,6 @@ abstract class ApiTestCaseUpload extends ApiTestCase { ); return true; - } function fakeUploadChunk( $fieldName, $fileName, $type, & $chunkData ) { @@ -145,5 +146,4 @@ abstract class ApiTestCaseUpload extends ApiTestCase { function clearFakeUploads() { $_FILES = array(); } - } diff --git a/tests/phpunit/includes/api/ApiUploadTest.php b/tests/phpunit/includes/api/ApiUploadTest.php index 881fed5bd4..c418a87327 100644 --- a/tests/phpunit/includes/api/ApiUploadTest.php +++ b/tests/phpunit/includes/api/ApiUploadTest.php @@ -58,8 +58,8 @@ class ApiUploadTest extends ApiTestCaseUpload { $this->assertArrayHasKey( 'lgtoken', $result['login'] ); $this->assertNotEmpty( $session, 'API Login must return a session' ); - return $session; + return $session; } /** @@ -117,7 +117,6 @@ class ApiUploadTest extends ApiTestCaseUpload { $this->deleteFileByFileName( $fileName ); $this->deleteFileByContent( $filePath ); - if ( !$this->fakeUploadFile( 'file', $fileName, $mimeType, $filePath ) ) { $this->markTestIncomplete( "Couldn't upload file!\n" ); } @@ -306,7 +305,6 @@ class ApiUploadTest extends ApiTestCaseUpload { $this->assertEquals( 'Success', $result['upload']['result'] ); $this->assertFalse( $exception ); - // second upload with the same content (but different name) if ( !$this->fakeUploadFile( 'file', $fileNames[1], $mimeType, $filePaths[0] ) ) { diff --git a/tests/phpunit/includes/api/RandomImageGenerator.php b/tests/phpunit/includes/api/RandomImageGenerator.php index 30407582c9..1b815ac766 100644 --- a/tests/phpunit/includes/api/RandomImageGenerator.php +++ b/tests/phpunit/includes/api/RandomImageGenerator.php @@ -108,6 +108,7 @@ class RandomImageGenerator { foreach ( $filenames as $filename ) { $this->{$imageWriteMethod}( $this->getImageSpec(), $format, $filename ); } + return $filenames; } @@ -156,7 +157,6 @@ class RandomImageGenerator { } return $filenames; - } @@ -196,7 +196,6 @@ class RandomImageGenerator { array( 'x' => $originX, 'y' => $originY - $radius ) ); $draws[] = $draw; - } $spec['draws'] = $draws; @@ -216,6 +215,7 @@ class RandomImageGenerator { foreach ( $shape as $point ) { $points[] = $point['x'] . ',' . $point['y']; } + return join( " ", $points ); } @@ -337,6 +337,7 @@ class RandomImageGenerator { } $tSpec['draws'][] = $tDraw; } + return $tSpec; } @@ -384,6 +385,7 @@ class RandomImageGenerator { $command = wfEscapeShellArg( $wgImageMagickConvertCommand ) . " " . implode( " ", $args ); $retval = null; wfShellExec( $command, $retval ); + return ( $retval === 0 ); } @@ -397,6 +399,7 @@ class RandomImageGenerator { for ( $i = 0; $i <= 2; $i++ ) { $components[] = mt_rand( 0, 255 ); } + return 'rgb(' . join( ', ', $components ) . ')'; } @@ -414,6 +417,7 @@ class RandomImageGenerator { for ( $i = 0; $i < $count; $i += 2 ) { $pairs[] = array( $lines[$i], $lines[$i + 1] ); } + return $pairs; } @@ -461,5 +465,4 @@ class RandomImageGenerator { return $lines; } - } diff --git a/tests/phpunit/includes/api/format/ApiFormatPhpTest.php b/tests/phpunit/includes/api/format/ApiFormatPhpTest.php index a59983d8da..802a0e1f0e 100644 --- a/tests/phpunit/includes/api/format/ApiFormatPhpTest.php +++ b/tests/phpunit/includes/api/format/ApiFormatPhpTest.php @@ -13,7 +13,5 @@ class ApiFormatPhpTest extends ApiFormatTestBase { $this->assertInternalType( 'array', unserialize( $data ) ); $this->assertGreaterThan( 0, count( (array)$data ) ); - } - } diff --git a/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php b/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php index e0a84e1a07..7f32e5f2a9 100644 --- a/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php +++ b/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php @@ -68,6 +68,7 @@ abstract class ApiQueryContinueTestBase extends ApiQueryTestBase { // put 'continue' params at the end - lazy method $a = strpos( $a, 'continue' ) !== false ? 'zzz ' . $a : $a; $b = strpos( $b, 'continue' ) !== false ? 'zzz ' . $b : $b; + return strcmp( $a, $b ); } ); $reqStr = http_build_query( $request ); @@ -103,6 +104,7 @@ abstract class ApiQueryContinueTestBase extends ApiQueryTestBase { if ( $expectedCount > $count ) { print "***** $id Finished early in $count turns. $expectedCount was expected\n"; } + return $result; } elseif ( !$useContinue ) { $this->assertFalse( 'Non-smart query must be requested all at once' ); diff --git a/tests/phpunit/includes/api/query/ApiQueryTest.php b/tests/phpunit/includes/api/query/ApiQueryTest.php index 7fb53073db..bc01ec2b0b 100644 --- a/tests/phpunit/includes/api/query/ApiQueryTest.php +++ b/tests/phpunit/includes/api/query/ApiQueryTest.php @@ -20,7 +20,6 @@ class ApiQueryTest extends ApiTestCase { 'action' => 'query', 'titles' => 'Project:articleA|article_B' ) ); - $this->assertArrayHasKey( 'query', $data[0] ); $this->assertArrayHasKey( 'normalized', $data[0]['query'] ); @@ -42,7 +41,6 @@ class ApiQueryTest extends ApiTestCase { ), $data[0]['query']['normalized'][1] ); - } function testTitlesAreRejectedIfInvalid() { @@ -65,5 +63,4 @@ class ApiQueryTest extends ApiTestCase { $this->assertArrayHasKey( 'missing', $data[0]['query']['pages'][-2] ); $this->assertArrayHasKey( 'invalid', $data[0]['query']['pages'][-1] ); } - } diff --git a/tests/phpunit/includes/api/query/ApiQueryTestBase.php b/tests/phpunit/includes/api/query/ApiQueryTestBase.php index 3d96beb31f..d712bc08e1 100644 --- a/tests/phpunit/includes/api/query/ApiQueryTestBase.php +++ b/tests/phpunit/includes/api/query/ApiQueryTestBase.php @@ -24,7 +24,6 @@ * @file */ - /** This class has some common functionality for testing query module */ abstract class ApiQueryTestBase extends ApiTestCase { @@ -48,6 +47,7 @@ STR; $request = array_merge_recursive( $request, $req ); $this->mergeExpected( $expected, $exp ); } + return array( $request, $expected ); } @@ -62,6 +62,7 @@ STR; $this->assertArrayHasKey( 1, $v, self::PARAM_ASSERT ); $this->assertType( 'array', $v[0], self::PARAM_ASSERT ); $this->assertType( 'array', $v[1], self::PARAM_ASSERT ); + return $v; } diff --git a/tests/phpunit/includes/cache/ProcessCacheLRUTest.php b/tests/phpunit/includes/cache/ProcessCacheLRUTest.php index 1070f7fc85..1c81ea7261 100644 --- a/tests/phpunit/includes/cache/ProcessCacheLRUTest.php +++ b/tests/phpunit/includes/cache/ProcessCacheLRUTest.php @@ -52,6 +52,7 @@ class ProcessCacheLRUTest extends MediaWikiTestCase { for ( $i = $firstKey; $i <= $lastKey; $i++ ) { $expected["cache-key-$i"] = array( "prop-$i" => "value-$i" ); } + return $expected; } @@ -125,7 +126,6 @@ class ProcessCacheLRUTest extends MediaWikiTestCase { $cache->getCache(), "Filling a $cacheMaxEntries entries cache with $entryToFill entries" ); - } /** @@ -218,9 +218,7 @@ class ProcessCacheLRUTest extends MediaWikiTestCase { ), $cache->getCache() ); - } - } /** diff --git a/tests/phpunit/includes/content/ContentHandlerTest.php b/tests/phpunit/includes/content/ContentHandlerTest.php index 67d4fdea8e..c3455133e2 100644 --- a/tests/phpunit/includes/content/ContentHandlerTest.php +++ b/tests/phpunit/includes/content/ContentHandlerTest.php @@ -317,6 +317,7 @@ class DummyContentHandlerForTesting extends ContentHandler { */ public function unserializeContent( $blob, $format = null ) { $d = unserialize( $blob ); + return new DummyContentForTesting( $d ); } diff --git a/tests/phpunit/includes/content/CssContentTest.php b/tests/phpunit/includes/content/CssContentTest.php index 8f53dd3e9a..1c458203c7 100644 --- a/tests/phpunit/includes/content/CssContentTest.php +++ b/tests/phpunit/includes/content/CssContentTest.php @@ -77,5 +77,4 @@ class CssContentTest extends MediaWikiTestCase { public function testEquals( Content $a, Content $b = null, $equal = false ) { $this->assertEquals( $equal, $a->equals( $b ) ); } - } diff --git a/tests/phpunit/includes/content/JavaScriptContentTest.php b/tests/phpunit/includes/content/JavaScriptContentTest.php index 2d693feb3d..6632edd57a 100644 --- a/tests/phpunit/includes/content/JavaScriptContentTest.php +++ b/tests/phpunit/includes/content/JavaScriptContentTest.php @@ -269,5 +269,4 @@ class JavaScriptContentTest extends TextContentTest { array( new JavaScriptContent( "hallo" ), new JavaScriptContent( "HALLO" ), false ), ); } - } diff --git a/tests/phpunit/includes/content/TextContentTest.php b/tests/phpunit/includes/content/TextContentTest.php index 4fc2d51d03..28c006cc3e 100644 --- a/tests/phpunit/includes/content/TextContentTest.php +++ b/tests/phpunit/includes/content/TextContentTest.php @@ -423,5 +423,4 @@ class TextContentTest extends MediaWikiLangTestCase { $this->assertEquals( $expectedNative, $converted->getNativeData() ); } } - } diff --git a/tests/phpunit/includes/content/WikitextContentHandlerTest.php b/tests/phpunit/includes/content/WikitextContentHandlerTest.php index 0f6a968b62..45d814068f 100644 --- a/tests/phpunit/includes/content/WikitextContentHandlerTest.php +++ b/tests/phpunit/includes/content/WikitextContentHandlerTest.php @@ -181,5 +181,4 @@ class WikitextContentHandlerTest extends MediaWikiLangTestCase { /* public function testGetUndoContent( Revision $current, Revision $undo, Revision $undoafter = null ) {} */ - } diff --git a/tests/phpunit/includes/db/DatabaseSQLTest.php b/tests/phpunit/includes/db/DatabaseSQLTest.php index caa3368ab6..965a5f388f 100644 --- a/tests/phpunit/includes/db/DatabaseSQLTest.php +++ b/tests/phpunit/includes/db/DatabaseSQLTest.php @@ -231,7 +231,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { ), "DELETE FROM table " . "WHERE field IN (" . - "SELECT field_join FROM table_join WHERE alias = 'text'" . + "SELECT field_join FROM table_join WHERE alias = 'text'" . ")" ), array( @@ -244,7 +244,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { ), "DELETE FROM table " . "WHERE field IN (" . - "SELECT field_join FROM table_join " . + "SELECT field_join FROM table_join " . ")" ), ); @@ -296,8 +296,8 @@ class DatabaseSQLTest extends MediaWikiTestCase { "INSERT IGNORE INTO table " . "(field,field2) " . "VALUES " . - "('text','2')," . - "('multi','3')" + "('text','2')," . + "('multi','3')" ), ); } @@ -330,7 +330,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { "INSERT INTO insert_table " . "(field_insert,field) " . "SELECT field_select,field2 " . - "FROM select_table" + "FROM select_table" ), array( array( @@ -342,8 +342,8 @@ class DatabaseSQLTest extends MediaWikiTestCase { "INSERT INTO insert_table " . "(field_insert,field) " . "SELECT field_select,field2 " . - "FROM select_table " . - "WHERE field = '2'" + "FROM select_table " . + "WHERE field = '2'" ), array( array( @@ -357,9 +357,9 @@ class DatabaseSQLTest extends MediaWikiTestCase { "INSERT IGNORE INTO insert_table " . "(field_insert,field) " . "SELECT field_select,field2 " . - "FROM select_table " . - "WHERE field = '2' " . - "ORDER BY field" + "FROM select_table " . + "WHERE field = '2' " . + "ORDER BY field" ), ); } @@ -388,8 +388,8 @@ class DatabaseSQLTest extends MediaWikiTestCase { "DELETE FROM replace_table " . "WHERE ( field='text' ); " . "INSERT INTO replace_table " . - "(field,field2) " . - "VALUES ('text','text2')" + "(field,field2) " . + "VALUES ('text','text2')" ), array( array( @@ -404,8 +404,8 @@ class DatabaseSQLTest extends MediaWikiTestCase { "DELETE FROM module_deps " . "WHERE ( md_module='module' AND md_skin='skin' ); " . "INSERT INTO module_deps " . - "(md_module,md_skin,md_deps) " . - "VALUES ('module','skin','deps')" + "(md_module,md_skin,md_deps) " . + "VALUES ('module','skin','deps')" ), array( array( @@ -426,13 +426,13 @@ class DatabaseSQLTest extends MediaWikiTestCase { "DELETE FROM module_deps " . "WHERE ( md_module='module' AND md_skin='skin' ); " . "INSERT INTO module_deps " . - "(md_module,md_skin,md_deps) " . - "VALUES ('module','skin','deps'); " . - "DELETE FROM module_deps " . + "(md_module,md_skin,md_deps) " . + "VALUES ('module','skin','deps'); " . + "DELETE FROM module_deps " . "WHERE ( md_module='module2' AND md_skin='skin2' ); " . "INSERT INTO module_deps " . - "(md_module,md_skin,md_deps) " . - "VALUES ('module2','skin2','deps2')" + "(md_module,md_skin,md_deps) " . + "VALUES ('module2','skin2','deps2')" ), array( array( @@ -453,13 +453,13 @@ class DatabaseSQLTest extends MediaWikiTestCase { "DELETE FROM module_deps " . "WHERE ( md_module='module' ) OR ( md_skin='skin' ); " . "INSERT INTO module_deps " . - "(md_module,md_skin,md_deps) " . - "VALUES ('module','skin','deps'); " . - "DELETE FROM module_deps " . + "(md_module,md_skin,md_deps) " . + "VALUES ('module','skin','deps'); " . + "DELETE FROM module_deps " . "WHERE ( md_module='module2' ) OR ( md_skin='skin2' ); " . "INSERT INTO module_deps " . - "(md_module,md_skin,md_deps) " . - "VALUES ('module2','skin2','deps2')" + "(md_module,md_skin,md_deps) " . + "VALUES ('module2','skin2','deps2')" ), array( array( diff --git a/tests/phpunit/includes/db/DatabaseSqliteTest.php b/tests/phpunit/includes/db/DatabaseSqliteTest.php index 097e57aaa4..815edd2ff5 100644 --- a/tests/phpunit/includes/db/DatabaseSqliteTest.php +++ b/tests/phpunit/includes/db/DatabaseSqliteTest.php @@ -9,6 +9,7 @@ class MockDatabaseSqlite extends DatabaseSqliteStandalone { function query( $sql, $fname = '', $tempIgnore = false ) { $this->lastQuery = $sql; + return true; } @@ -327,6 +328,7 @@ class DatabaseSqliteTest extends MediaWikiTestCase { $db->sourceFile( "$IP/tests/phpunit/data/db/sqlite/tables-$version.sql" ); $updater = DatabaseUpdater::newForDB( $db, false, $maint ); $updater->doUpdates( array( 'core' ) ); + return $db; } @@ -348,6 +350,7 @@ class DatabaseSqliteTest extends MediaWikiTestCase { } $list = array_flip( $list ); sort( $list ); + return $list; } @@ -359,6 +362,7 @@ class DatabaseSqliteTest extends MediaWikiTestCase { $cols[$col->name] = $col; } ksort( $cols ); + return $cols; } @@ -376,6 +380,7 @@ class DatabaseSqliteTest extends MediaWikiTestCase { $indexes[$index->name] = $index; } ksort( $indexes ); + return $indexes; } diff --git a/tests/phpunit/includes/db/DatabaseTestHelper.php b/tests/phpunit/includes/db/DatabaseTestHelper.php index 1efa279b58..57df08ec3e 100644 --- a/tests/phpunit/includes/db/DatabaseTestHelper.php +++ b/tests/phpunit/includes/db/DatabaseTestHelper.php @@ -36,6 +36,7 @@ class DatabaseTestHelper extends DatabaseBase { public function getLastSqls() { $lastSqls = implode( '; ', $this->lastSqls ); $this->lastSqls = array(); + return $lastSqls; } @@ -78,6 +79,7 @@ class DatabaseTestHelper extends DatabaseBase { public function tableExists( $table, $fname = __METHOD__ ) { $this->checkFunctionName( $fname ); + return in_array( $table, (array)$this->tablesExists ); } diff --git a/tests/phpunit/includes/db/ORMRowTest.php b/tests/phpunit/includes/db/ORMRowTest.php index 596d0bd088..27d4d0e87f 100644 --- a/tests/phpunit/includes/db/ORMRowTest.php +++ b/tests/phpunit/includes/db/ORMRowTest.php @@ -76,6 +76,7 @@ abstract class ORMRowTest extends \MediaWikiTestCase { */ protected function getRowInstance( array $data, $loadDefaults ) { $class = $this->getRowClass(); + return new $class( $this->getTableInstance(), $data, $loadDefaults ); } diff --git a/tests/phpunit/includes/db/ORMTableTest.php b/tests/phpunit/includes/db/ORMTableTest.php index 4cadf31cf2..e583d1bcac 100644 --- a/tests/phpunit/includes/db/ORMTableTest.php +++ b/tests/phpunit/includes/db/ORMTableTest.php @@ -45,6 +45,7 @@ class ORMTableTest extends MediaWikiTestCase { */ public function getTable() { $class = $this->getTableClass(); + return $class::singleton(); } @@ -84,7 +85,6 @@ class ORMTableTest extends MediaWikiTestCase { $db->ignoreErrors( false ); } - } /** diff --git a/tests/phpunit/includes/db/TestORMRowTest.php b/tests/phpunit/includes/db/TestORMRowTest.php index 263553ac8b..f32610b7e5 100644 --- a/tests/phpunit/includes/db/TestORMRowTest.php +++ b/tests/phpunit/includes/db/TestORMRowTest.php @@ -122,10 +122,10 @@ class TestORMRowTest extends ORMRowTest { 'blob' => new stdClass() ); } - } -class TestORMRow extends ORMRow {} +class TestORMRow extends ORMRow { +} class TestORMTable extends ORMTable { @@ -194,6 +194,4 @@ class TestORMTable extends ORMTable { protected function getFieldPrefix() { return 'test_'; } - - } diff --git a/tests/phpunit/includes/filebackend/FileBackendTest.php b/tests/phpunit/includes/filebackend/FileBackendTest.php index 3991c93116..0d6e4d5921 100644 --- a/tests/phpunit/includes/filebackend/FileBackendTest.php +++ b/tests/phpunit/includes/filebackend/FileBackendTest.php @@ -315,6 +315,7 @@ class FileBackendTest extends MediaWikiTestCase { "Source file $source does not exist ($backendName)." ); $this->assertEquals( false, $this->backend->fileExists( array( 'src' => $dest ) ), "Destination file $dest does not exist ($backendName)." ); + return; // done } @@ -434,6 +435,7 @@ class FileBackendTest extends MediaWikiTestCase { "Source file $source does not exist ($backendName)." ); $this->assertEquals( false, $this->backend->fileExists( array( 'src' => $dest ) ), "Destination file $dest does not exist ($backendName)." ); + return; // done } @@ -1369,6 +1371,7 @@ class FileBackendTest extends MediaWikiTestCase { public static function provider_testPrepareAndClean() { $base = self::baseStorePath(); + return array( array( "$base/unittest-cont1/e/a/z/some_file1.txt", true ), array( "$base/unittest-cont2/a/z/some_file2.txt", true ), @@ -2192,6 +2195,7 @@ class FileBackendTest extends MediaWikiTestCase { // test helper wrapper for backend prepare() function private function create( array $params ) { $params['op'] = 'create'; + return $this->backend->doQuickOperations( array( $params ) ); } diff --git a/tests/phpunit/includes/filerepo/StoreBatchTest.php b/tests/phpunit/includes/filerepo/StoreBatchTest.php index a89ef98e94..71a585ee6e 100644 --- a/tests/phpunit/includes/filerepo/StoreBatchTest.php +++ b/tests/phpunit/includes/filerepo/StoreBatchTest.php @@ -69,6 +69,7 @@ class StoreBatchTest extends MediaWikiTestCase { $result = $this->repo->store( $srcPath, 'temp', $dstRel, $flags ); $result->value = $this->repo->getVirtualUrl( 'temp' ) . '/' . $dstUrlRel; $this->createdFiles[] = $result->value; + return $result; } diff --git a/tests/phpunit/includes/jobqueue/JobQueueTest.php b/tests/phpunit/includes/jobqueue/JobQueueTest.php index 820f8c588b..787b43109f 100644 --- a/tests/phpunit/includes/jobqueue/JobQueueTest.php +++ b/tests/phpunit/includes/jobqueue/JobQueueTest.php @@ -46,7 +46,8 @@ class JobQueueTest extends MediaWikiTestCase { if ( !( $this->$q instanceof JobQueueDB ) ) { $this->$q->setTestingPrefix( 'unittests-' . wfRandomString( 32 ) ); } - } catch ( MWException $e ) {}; // unsupported? (@TODO: what if it was another error?) + } catch ( MWException $e ) { + }; // unsupported? (@TODO: what if it was another error?) } } @@ -109,7 +110,6 @@ class JobQueueTest extends MediaWikiTestCase { $jobs = iterator_to_array( $queue->getAllQueuedJobs() ); $this->assertEquals( 2, count( $jobs ), "Queue iterator size is correct ($desc)" ); - $job1 = $queue->pop(); $this->assertFalse( $queue->isEmpty(), "Queue is not empty ($desc)" ); diff --git a/tests/phpunit/includes/json/FormatJsonTest.php b/tests/phpunit/includes/json/FormatJsonTest.php index 0782e4e54a..ef263c4dd4 100644 --- a/tests/phpunit/includes/json/FormatJsonTest.php +++ b/tests/phpunit/includes/json/FormatJsonTest.php @@ -88,7 +88,6 @@ class FormatJsonTest extends MediaWikiTestCase { strtolower( FormatJson::encode( "\xf0\xa0\x80\x80" ) ), 'Test encoding an broken json_encode character (U+20000)' ); - } public function testDecodeReturnType() { @@ -156,6 +155,7 @@ class FormatJsonTest extends MediaWikiTestCase { $cases[] = array( $from, '"' . ( $leaveUnescaped ? $from : $to ) . '"' ); } } + return $cases; } } diff --git a/tests/phpunit/includes/libs/GenericArrayObjectTest.php b/tests/phpunit/includes/libs/GenericArrayObjectTest.php index 37a9b347f4..7436c43c8d 100644 --- a/tests/phpunit/includes/libs/GenericArrayObjectTest.php +++ b/tests/phpunit/includes/libs/GenericArrayObjectTest.php @@ -73,6 +73,7 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase { */ protected function getNew( array $elements = array() ) { $class = $this->getInstanceClass(); + return new $class( $elements ); } @@ -197,6 +198,7 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase { public function testOffsetSet( array $elements ) { if ( $elements === array() ) { $this->assertTrue( true ); + return; } @@ -258,5 +260,4 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase { $this->assertArrayEquals( $list, $copy, true, true ); } - } diff --git a/tests/phpunit/includes/media/BitmapMetadataHandlerTest.php b/tests/phpunit/includes/media/BitmapMetadataHandlerTest.php index 117a072cd7..ffa6084939 100644 --- a/tests/phpunit/includes/media/BitmapMetadataHandlerTest.php +++ b/tests/phpunit/includes/media/BitmapMetadataHandlerTest.php @@ -146,5 +146,4 @@ class BitmapMetadataHandlerTest extends MediaWikiTestCase { $res = $handler->getTiffByteOrder( $this->filePath . 'test.tiff' ); $this->assertEquals( 'LE', $res ); } - } diff --git a/tests/phpunit/includes/media/ExifTest.php b/tests/phpunit/includes/media/ExifTest.php index e7e95f7ed5..6ad28ac514 100644 --- a/tests/phpunit/includes/media/ExifTest.php +++ b/tests/phpunit/includes/media/ExifTest.php @@ -39,6 +39,4 @@ class ExifTest extends MediaWikiTestCase { ); $this->assertEquals( $expected, $data ); } - - } diff --git a/tests/phpunit/includes/media/IPTCTest.php b/tests/phpunit/includes/media/IPTCTest.php index c9648a793c..81a58ddc30 100644 --- a/tests/phpunit/includes/media/IPTCTest.php +++ b/tests/phpunit/includes/media/IPTCTest.php @@ -56,5 +56,4 @@ class IPTCTest extends MediaWikiTestCase { $res = IPTC::Parse( $iptcData ); $this->assertEquals( array( '¼' ), $res['Keywords'] ); } - } diff --git a/tests/phpunit/includes/media/PNGMetadataExtractorTest.php b/tests/phpunit/includes/media/PNGMetadataExtractorTest.php index 3bbce2bd05..58d791fdfe 100644 --- a/tests/phpunit/includes/media/PNGMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/PNGMetadataExtractorTest.php @@ -52,7 +52,6 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase { // encoded as just \xA9. $expected = "© 2010 Bawolff"; - $this->assertArrayHasKey( 'text', $meta ); $meta = $meta['text']; $this->assertArrayHasKey( 'Copyright', $meta ); @@ -149,5 +148,4 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase { 'greyscale-na-png.png' ); $this->assertEquals( 'greyscale', $meta['colorType'] ); } - } diff --git a/tests/phpunit/includes/media/SVGMetadataExtractorTest.php b/tests/phpunit/includes/media/SVGMetadataExtractorTest.php index 97a0000da6..3bf9c59ff8 100644 --- a/tests/phpunit/includes/media/SVGMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/SVGMetadataExtractorTest.php @@ -21,6 +21,7 @@ class SVGMetadataExtractorTest extends MediaWikiTestCase { $r = new XMLReader(); if ( !method_exists( $r, 'readInnerXML' ) ) { $this->markTestSkipped( 'XMLReader::readInnerXML() does not exist (libxml >2.6.20 needed).' ); + return; } $this->assertMetadata( $infile, $expected ); @@ -41,6 +42,7 @@ class SVGMetadataExtractorTest extends MediaWikiTestCase { public static function provideSvgFiles() { $base = __DIR__ . '/../../data/media'; + return array( array( "$base/Wikimedia-logo.svg", diff --git a/tests/phpunit/includes/media/XMPTest.php b/tests/phpunit/includes/media/XMPTest.php index 86c722b194..3e39675f44 100644 --- a/tests/phpunit/includes/media/XMPTest.php +++ b/tests/phpunit/includes/media/XMPTest.php @@ -65,6 +65,7 @@ class XMPTest extends MediaWikiTestCase { include( $xmpPath . $file[0] . '.result.php' ); $data[] = array( $xmp, $result, '[' . $file[0] . '.xmp] ' . $file[1] ); } + return $data; } @@ -157,5 +158,4 @@ class XMPTest extends MediaWikiTestCase { $this->assertEquals( $expected, $actual ); } - } diff --git a/tests/phpunit/includes/media/XMPValidateTest.php b/tests/phpunit/includes/media/XMPValidateTest.php index a2b4e1c29a..257c40af33 100644 --- a/tests/phpunit/includes/media/XMPValidateTest.php +++ b/tests/phpunit/includes/media/XMPValidateTest.php @@ -41,7 +41,5 @@ class XMPValidateTest extends MediaWikiTestCase { array( '2001-05-12T15', null ), array( '2001-12T15:13', null ), ); - } - } diff --git a/tests/phpunit/includes/objectcache/BagOStuffTest.php b/tests/phpunit/includes/objectcache/BagOStuffTest.php index 88b07f0ae5..be603e5050 100644 --- a/tests/phpunit/includes/objectcache/BagOStuffTest.php +++ b/tests/phpunit/includes/objectcache/BagOStuffTest.php @@ -15,7 +15,6 @@ class BagOStuffTest extends MediaWikiTestCase { $name = $this->getCliArg( 'use-bagostuff=' ); $this->cache = ObjectCache::newFromId( $name ); - } else { // no type defined - use simple hash $this->cache = new HashBagOStuff; diff --git a/tests/phpunit/includes/parser/MediaWikiParserTest.php b/tests/phpunit/includes/parser/MediaWikiParserTest.php index abc2f61446..3939c4fba9 100644 --- a/tests/phpunit/includes/parser/MediaWikiParserTest.php +++ b/tests/phpunit/includes/parser/MediaWikiParserTest.php @@ -41,6 +41,7 @@ EOT; $parserTester = new $parserTestClassName( $testsName ); $suite->addTestSuite( new ReflectionClass ( $parserTester ) ); } + return $suite; } } diff --git a/tests/phpunit/includes/parser/NewParserTest.php b/tests/phpunit/includes/parser/NewParserTest.php index 77311b90a9..934f181051 100644 --- a/tests/phpunit/includes/parser/NewParserTest.php +++ b/tests/phpunit/includes/parser/NewParserTest.php @@ -86,7 +86,6 @@ class NewParserTest extends MediaWikiTestCase { $tmpGlobals['wgStyleDirectory'] = "$IP/skins"; } - foreach ( $tmpGlobals as $var => $val ) { if ( array_key_exists( $var, $GLOBALS ) ) { $this->savedInitialGlobals[$var] = $GLOBALS[$var]; @@ -432,6 +431,7 @@ class NewParserTest extends MediaWikiTestCase { // wfDebug( "Creating upload directory $dir\n" ); if ( file_exists( $dir ) ) { wfDebug( "Already exists!\n" ); + return $dir; } @@ -543,6 +543,7 @@ class NewParserTest extends MediaWikiTestCase { global $wgParserTestFiles; $this->file = $wgParserTestFiles[0]; } + return new TestFileIterator( $this->file, $this ); } @@ -717,7 +718,6 @@ class NewParserTest extends MediaWikiTestCase { } $id++; - } } @@ -911,6 +911,7 @@ class NewParserTest extends MediaWikiTestCase { } } } + return $opts; } @@ -922,6 +923,7 @@ class NewParserTest extends MediaWikiTestCase { if ( substr( $opt, 0, 2 ) == '[[' ) { return substr( $opt, 2, -2 ); } + return $opt; } diff --git a/tests/phpunit/includes/parser/ParserMethodsTest.php b/tests/phpunit/includes/parser/ParserMethodsTest.php index 50fe0e4d9a..cacbb850df 100644 --- a/tests/phpunit/includes/parser/ParserMethodsTest.php +++ b/tests/phpunit/includes/parser/ParserMethodsTest.php @@ -44,6 +44,5 @@ class ParserMethodsTest extends MediaWikiLangTestCase { 'text' => '
foo
', ), $ret, 'callParserFunction works for {{#tag:pre|foo|style=margin-left: 1.6em}}' ); } - // TODO: Add tests for cleanSig() / cleanSigInSig(), getSection(), replaceSection(), getPreloadText() } diff --git a/tests/phpunit/includes/parser/ParserPreloadTest.php b/tests/phpunit/includes/parser/ParserPreloadTest.php index e16b407edc..c6091640a2 100644 --- a/tests/phpunit/includes/parser/ParserPreloadTest.php +++ b/tests/phpunit/includes/parser/ParserPreloadTest.php @@ -68,5 +68,4 @@ class ParserPreloadTest extends MediaWikiTestCase { $msg ); } - } diff --git a/tests/phpunit/includes/search/SearchEngineTest.php b/tests/phpunit/includes/search/SearchEngineTest.php index 6abca6d4a1..47c47f646b 100644 --- a/tests/phpunit/includes/search/SearchEngineTest.php +++ b/tests/phpunit/includes/search/SearchEngineTest.php @@ -87,6 +87,7 @@ class SearchEngineTest extends MediaWikiLangTestCase { # sort them numerically so we will compare simply that we received # the expected matches. sort( $matches ); + return $matches; } @@ -172,5 +173,4 @@ class SearchEngineTest extends MediaWikiLangTestCase { $this->fetchIds( $this->search->searchTitle( 'smithee' ) ), "Title power search failed" ); } - } diff --git a/tests/phpunit/includes/search/SearchUpdateTest.php b/tests/phpunit/includes/search/SearchUpdateTest.php index 7d867bc497..d19cdd031e 100644 --- a/tests/phpunit/includes/search/SearchUpdateTest.php +++ b/tests/phpunit/includes/search/SearchUpdateTest.php @@ -28,6 +28,7 @@ class SearchUpdateTest extends MediaWikiTestCase { function update( $text, $title = 'Test', $id = 1 ) { $u = new SearchUpdate( $id, $title, $text ); $u->doUpdate(); + return array( MockSearch::$title, MockSearch::$text ); } diff --git a/tests/phpunit/includes/site/MediaWikiSiteTest.php b/tests/phpunit/includes/site/MediaWikiSiteTest.php index b86636f1c1..e0092a55a2 100644 --- a/tests/phpunit/includes/site/MediaWikiSiteTest.php +++ b/tests/phpunit/includes/site/MediaWikiSiteTest.php @@ -85,5 +85,4 @@ class MediaWikiSiteTest extends SiteTest { $this->assertContains( $path, $site->getPageUrl() ); $this->assertContains( $expected, $site->getPageUrl( $page ) ); } - } diff --git a/tests/phpunit/includes/site/SiteListTest.php b/tests/phpunit/includes/site/SiteListTest.php index c329839759..bd2ae078bb 100644 --- a/tests/phpunit/includes/site/SiteListTest.php +++ b/tests/phpunit/includes/site/SiteListTest.php @@ -186,5 +186,4 @@ class SiteListTest extends MediaWikiTestCase { $this->assertTrue( $copy->hasInternalId( $site->getInternalId() ) ); } } - } diff --git a/tests/phpunit/includes/site/SiteSQLStoreTest.php b/tests/phpunit/includes/site/SiteSQLStoreTest.php index cf4ce945b8..cf652e957c 100644 --- a/tests/phpunit/includes/site/SiteSQLStoreTest.php +++ b/tests/phpunit/includes/site/SiteSQLStoreTest.php @@ -119,5 +119,4 @@ class SiteSQLStoreTest extends MediaWikiTestCase { $sites = $store->getSites(); $this->assertEquals( 0, $sites->count() ); } - } diff --git a/tests/phpunit/includes/site/SiteTest.php b/tests/phpunit/includes/site/SiteTest.php index 80337847d2..b453e7437e 100644 --- a/tests/phpunit/includes/site/SiteTest.php +++ b/tests/phpunit/includes/site/SiteTest.php @@ -263,5 +263,4 @@ class SiteTest extends MediaWikiTestCase { $this->assertEquals( $serialization, serialize( $newInstance ) ); } - } diff --git a/tests/phpunit/includes/site/TestSites.php b/tests/phpunit/includes/site/TestSites.php index a5656a73f5..f224b7d774 100644 --- a/tests/phpunit/includes/site/TestSites.php +++ b/tests/phpunit/includes/site/TestSites.php @@ -97,5 +97,4 @@ class TestSites { $sitesTable->clear(); $sitesTable->saveSites( TestSites::getSites() ); } - } diff --git a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php index add830b007..436eb2e2b5 100644 --- a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php +++ b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php @@ -42,7 +42,6 @@ class SpecialRecentchangesTest extends MediaWikiTestCase { /** return false if condition begin with 'rc_timestamp ' */ private static function filterOutRcTimestampCondition( $var ) { return ( false === strpos( $var, 'rc_timestamp ' ) ); - } public function testRcNsFilter() { @@ -123,5 +122,4 @@ class SpecialRecentchangesTest extends MediaWikiTestCase { array( NS_TALK, NS_MAIN ), ); } - } diff --git a/tests/phpunit/includes/specials/SpecialSearchTest.php b/tests/phpunit/includes/specials/SpecialSearchTest.php index 15a11ed308..c737f0524d 100644 --- a/tests/phpunit/includes/specials/SpecialSearchTest.php +++ b/tests/phpunit/includes/specials/SpecialSearchTest.php @@ -53,7 +53,6 @@ class SpecialSearchTest extends MediaWikiTestCase { ) , $message ); - } public static function provideSearchOptionsTests() { @@ -105,6 +104,7 @@ class SpecialSearchTest extends MediaWikiTestCase { foreach ( $opt as $name => $value ) { $u->setOption( $name, $value ); } + return $u; } @@ -135,6 +135,5 @@ class SpecialSearchTest extends MediaWikiTestCase { $pageTitle, "Search term '{$term}' should not be expanded in Special:Search " ); - } } diff --git a/tests/phpunit/includes/upload/UploadFromUrlTest.php b/tests/phpunit/includes/upload/UploadFromUrlTest.php index ab2b5ee9cb..a75fba69f1 100644 --- a/tests/phpunit/includes/upload/UploadFromUrlTest.php +++ b/tests/phpunit/includes/upload/UploadFromUrlTest.php @@ -30,6 +30,7 @@ class UploadFromUrlTest extends ApiTestCase { $module->execute(); wfSetupSession( $sessionId ); + return array( $module->getResultData(), $req ); } @@ -174,7 +175,6 @@ class UploadFromUrlTest extends ApiTestCase { $this->user->addGroup( 'users' ); - $data = $this->doAsyncUpload( $token ); $this->assertEquals( $data[0]['upload']['result'], 'Warning' ); @@ -277,7 +277,6 @@ class UploadFromUrlTest extends ApiTestCase { $this->assertFalse( $job ); return; - /* // Broken until using leavemessage with ignorewarnings is supported $job->run(); diff --git a/tests/phpunit/includes/upload/UploadTest.php b/tests/phpunit/includes/upload/UploadTest.php index b809d3205b..94c78dc534 100644 --- a/tests/phpunit/includes/upload/UploadTest.php +++ b/tests/phpunit/includes/upload/UploadTest.php @@ -130,15 +130,15 @@ class UploadTest extends MediaWikiTestCase { } class UploadTestHandler extends UploadBase { - public function initializeFromRequest( &$request ) {} + public function initializeFromRequest( &$request ) { + } public function testTitleValidation( $name ) { $this->mTitle = false; $this->mDesiredDestName = $name; $this->mTitleError = UploadBase::OK; $this->getTitle(); + return $this->mTitleError; } - - } diff --git a/tests/phpunit/languages/LanguageClassesTestCase.php b/tests/phpunit/languages/LanguageClassesTestCase.php index 6659dad179..4274335df5 100644 --- a/tests/phpunit/languages/LanguageClassesTestCase.php +++ b/tests/phpunit/languages/LanguageClassesTestCase.php @@ -96,5 +96,4 @@ abstract class LanguageClassesTestCase extends MediaWikiTestCase { unset( $this->languageObject ); parent::tearDown(); } - } diff --git a/tests/phpunit/languages/LanguageTest.php b/tests/phpunit/languages/LanguageTest.php index d5dbfb24db..80f76a5fa9 100644 --- a/tests/phpunit/languages/LanguageTest.php +++ b/tests/phpunit/languages/LanguageTest.php @@ -202,7 +202,6 @@ class LanguageTest extends LanguageClassesTestCase { 'formatTimePeriod() rounding, recursion, (>48h)' ), ); - } function testTruncate() { diff --git a/tests/phpunit/languages/LanguageTrTest.php b/tests/phpunit/languages/LanguageTrTest.php index 464a310cf3..6358ac08b8 100644 --- a/tests/phpunit/languages/LanguageTrTest.php +++ b/tests/phpunit/languages/LanguageTrTest.php @@ -56,5 +56,4 @@ class LanguageTrTest extends LanguageClassesTestCase { ); } - } diff --git a/tests/phpunit/languages/utils/CLDRPluralRuleEvaluatorTest.php b/tests/phpunit/languages/utils/CLDRPluralRuleEvaluatorTest.php index 73d5dcc066..3bf74146eb 100644 --- a/tests/phpunit/languages/utils/CLDRPluralRuleEvaluatorTest.php +++ b/tests/phpunit/languages/utils/CLDRPluralRuleEvaluatorTest.php @@ -89,7 +89,7 @@ class CLDRPluralRuleEvaluatorTest extends MediaWikiTestCase { array( 'n', 'just n' ), array( 'n is in 5', 'is in' ), ); + return $tests; } - } diff --git a/tests/phpunit/maintenance/DumpTestCase.php b/tests/phpunit/maintenance/DumpTestCase.php index f82898ffad..78a51533f7 100644 --- a/tests/phpunit/maintenance/DumpTestCase.php +++ b/tests/phpunit/maintenance/DumpTestCase.php @@ -124,6 +124,7 @@ abstract class DumpTestCase extends MediaWikiLangTestCase { return true; } } + return false; } @@ -145,6 +146,7 @@ abstract class DumpTestCase extends MediaWikiLangTestCase { return true; } } + return false; } @@ -271,7 +273,6 @@ abstract class DumpTestCase extends MediaWikiLangTestCase { $this->assertTextNode( "title", $name ); $this->assertTextNode( "ns", $ns ); $this->assertTextNode( "id", $id ); - } /** @@ -299,8 +300,8 @@ abstract class DumpTestCase extends MediaWikiLangTestCase { * @param $parentid int|false: (optional) id of the parent revision */ protected function assertRevision( $id, $summary, $text_id, $text_bytes, $text_sha1, $text = false, $parentid = false, - $model = CONTENT_MODEL_WIKITEXT, $format = CONTENT_FORMAT_WIKITEXT ) { - + $model = CONTENT_MODEL_WIKITEXT, $format = CONTENT_FORMAT_WIKITEXT + ) { $this->assertNodeStart( "revision" ); $this->skipWhitespace(); diff --git a/tests/phpunit/maintenance/MaintenanceTest.php b/tests/phpunit/maintenance/MaintenanceTest.php index 741f8b7f3b..f4b61afc2a 100644 --- a/tests/phpunit/maintenance/MaintenanceTest.php +++ b/tests/phpunit/maintenance/MaintenanceTest.php @@ -128,7 +128,6 @@ class MaintenanceFixup extends Maintenance { public function execute() { $this->testCase->fail( __METHOD__ . " called unexpectedly" ); } - } class MaintenanceTest extends MediaWikiTestCase { @@ -186,7 +185,6 @@ class MaintenanceTest extends MediaWikiTestCase { // test.*Intermittent.* tests), the objective of these tests is not to describe // consistent behavior, but rather currently existing behavior. - function testOutputEmpty() { $this->m->output( "" ); $this->assertOutputPrePostShutdown( "", false ); @@ -815,6 +813,4 @@ class MaintenanceTest extends MediaWikiTestCase { $m2->simulateShutdown(); $this->assertOutputPrePostShutdown( "foobar\n\n", false ); } - - } diff --git a/tests/phpunit/maintenance/backupPrefetchTest.php b/tests/phpunit/maintenance/backupPrefetchTest.php index cc00e6e502..bc2d73758a 100644 --- a/tests/phpunit/maintenance/backupPrefetchTest.php +++ b/tests/phpunit/maintenance/backupPrefetchTest.php @@ -36,7 +36,6 @@ class BaseDumpTest extends MediaWikiTestCase { private function assertPrefetchEquals( $expected, $page, $revision ) { $this->assertEquals( $expected, $this->dump->prefetch( $page, $revision ), "Prefetch of page $page revision $revision" ); - } function testSequential() { @@ -181,7 +180,6 @@ class BaseDumpTest extends MediaWikiTestCase { </siteinfo> '; - // An array holding the pages that are available for prefetch $available_pages = array(); @@ -274,5 +272,4 @@ class BaseDumpTest extends MediaWikiTestCase { return $fname; } - } diff --git a/tests/phpunit/maintenance/backupTextPassTest.php b/tests/phpunit/maintenance/backupTextPassTest.php index 0962344591..7fe48dd947 100644 --- a/tests/phpunit/maintenance/backupTextPassTest.php +++ b/tests/phpunit/maintenance/backupTextPassTest.php @@ -80,7 +80,6 @@ class TextPassDumperTest extends DumpTestCase { // DumpTestCase $this->exceptionFromAddDBData = $e; } - } protected function setUp() { @@ -94,7 +93,6 @@ class TextPassDumperTest extends DumpTestCase { array( $this->pageId2, $this->pageId3, $this->pageId4 ), array( $this->pageId1 + 1, $this->pageId2 + 1, $this->pageId3 + 1 ), "Page ids increasing without holes" ); - } function testPlain() { @@ -214,7 +212,6 @@ class TextPassDumperTest extends DumpTestCase { $this->assertPageEnd(); $this->assertDumpEnd(); - } /** @@ -239,7 +236,6 @@ class TextPassDumperTest extends DumpTestCase { $minDuration = 2; // We want the dump to take at least this many seconds $checkpointAfter = 0.5; // Generate checkpoint after this many seconds - // Until a dump takes at least $minDuration seconds, perform a dump and check // duration. If the dump did not take long enough increase the iteration // count, to generate a bigger stub file next time. @@ -579,6 +575,7 @@ class TextPassDumperTest extends DumpTestCase { $content .= $tail; $this->assertEquals( strlen( $content ), file_put_contents( $fname, $content ), "Length of prepared stub" ); + return $fname; } } diff --git a/tests/phpunit/maintenance/backup_LogTest.php b/tests/phpunit/maintenance/backup_LogTest.php index 5cf172e6aa..98d8165381 100644 --- a/tests/phpunit/maintenance/backup_LogTest.php +++ b/tests/phpunit/maintenance/backup_LogTest.php @@ -39,6 +39,7 @@ class BackupDumperLoggerTest extends DumpTestCase { if ( $parameters !== null ) { $logEntry->setParameters( $parameters ); } + return $logEntry->insert(); } @@ -75,14 +76,12 @@ class BackupDumperLoggerTest extends DumpTestCase { $user2, NS_MAIN, "PageA", "SomeOtherComment", array( 'key1' => 1, 3 => 'value3' ) ); $this->assertGreaterThan( 0, $this->logId3 ); - } catch ( Exception $e ) { // We'd love to pass $e directly. However, ... see // documentation of exceptionFromAddDBData in // DumpTestCase $this->exceptionFromAddDBData = $e; } - } @@ -226,5 +225,4 @@ class BackupDumperLoggerTest extends DumpTestCase { // the following statement to catch good output $this->expectOutputString( '' ); } - } diff --git a/tests/phpunit/maintenance/backup_PageTest.php b/tests/phpunit/maintenance/backup_PageTest.php index 07c7670523..535e61ecb7 100644 --- a/tests/phpunit/maintenance/backup_PageTest.php +++ b/tests/phpunit/maintenance/backup_PageTest.php @@ -79,7 +79,6 @@ class BackupDumperPageTest extends DumpTestCase { // DumpTestCase $this->exceptionFromAddDBData = $e; } - } protected function setUp() { @@ -93,7 +92,6 @@ class BackupDumperPageTest extends DumpTestCase { array( $this->pageId2, $this->pageId3, $this->pageId4 ), array( $this->pageId1 + 1, $this->pageId2 + 1, $this->pageId3 + 1 ), "Page ids increasing without holes" ); - } function testFullTextPlain() { @@ -403,6 +401,4 @@ class BackupDumperPageTest extends DumpTestCase { $this->expectETAOutput(); } - - } diff --git a/tests/phpunit/maintenance/fetchTextTest.php b/tests/phpunit/maintenance/fetchTextTest.php index 4d1d45d6ba..e8df199e77 100644 --- a/tests/phpunit/maintenance/fetchTextTest.php +++ b/tests/phpunit/maintenance/fetchTextTest.php @@ -63,7 +63,6 @@ class SemiMockedFetchText extends FetchText { return fopen( 'data://text/plain,' . $this->mockStdinText, 'r' ); } - } /** @@ -236,5 +235,4 @@ class FetchTextTest extends MediaWikiTestCase { $this->textId3 . "\n23\nFetchTextTestPage2Text2" ) ) ); } - } diff --git a/tests/phpunit/maintenance/getSlaveServerTest.php b/tests/phpunit/maintenance/getSlaveServerTest.php index 699571b728..2c8488622f 100644 --- a/tests/phpunit/maintenance/getSlaveServerTest.php +++ b/tests/phpunit/maintenance/getSlaveServerTest.php @@ -64,6 +64,4 @@ class GetSlaveServerTest extends MediaWikiTestCase { $this->expectOutputRegex( "/^[[:space:]]*\[wgDBprefix\][[:space:]]*=> " . $wgDBprefix . "$/m" ); } - - } diff --git a/tests/phpunit/phpunit.php b/tests/phpunit/phpunit.php index 2a1ebc3f79..b425d868e8 100755 --- a/tests/phpunit/phpunit.php +++ b/tests/phpunit/phpunit.php @@ -89,7 +89,6 @@ class PHPUnitMaintClass extends Maintenance { unset( $_SERVER['argv'][$key] ); // the option unset( $_SERVER['argv'][$key + 1] ); // its value $_SERVER['argv'] = array_values( $_SERVER['argv'] ); - } } diff --git a/tests/phpunit/resources/ResourcesTest.php b/tests/phpunit/resources/ResourcesTest.php index 62a6b1411e..3af805a958 100644 --- a/tests/phpunit/resources/ResourcesTest.php +++ b/tests/phpunit/resources/ResourcesTest.php @@ -116,7 +116,6 @@ class ResourcesTest extends MediaWikiTestCase { $file, ); } - } // Restore settings @@ -124,5 +123,4 @@ class ResourcesTest extends MediaWikiTestCase { return $cases; } - } diff --git a/tests/phpunit/skins/SideBarTest.php b/tests/phpunit/skins/SideBarTest.php index 876876b31a..850d39c791 100644 --- a/tests/phpunit/skins/SideBarTest.php +++ b/tests/phpunit/skins/SideBarTest.php @@ -100,7 +100,6 @@ class SideBarTest extends MediaWikiLangTestCase { ** http://valid.no.desc.org/ ' ); - } /** diff --git a/tests/phpunit/suites/UploadFromUrlTestSuite.php b/tests/phpunit/suites/UploadFromUrlTestSuite.php index 3200e0bd5a..b1496a9cfe 100644 --- a/tests/phpunit/suites/UploadFromUrlTestSuite.php +++ b/tests/phpunit/suites/UploadFromUrlTestSuite.php @@ -57,7 +57,6 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { $wgNamespaceAliases['Image'] = NS_FILE; $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK; - $wgEnableParserCache = false; DeferredUpdates::clearPendingUpdates(); $wgMemc = wfGetMainCache(); @@ -185,6 +184,7 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { if ( file_exists( $dir ) ) { wfDebug( "Already exists!\n" ); + return $dir; } @@ -202,6 +202,7 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { // the UploadFromUrlTest class class_exists( 'UploadFromUrlTest' ); $suite = new UploadFromUrlTestSuite( 'UploadFromUrlTest' ); + return $suite; } } -- 2.20.1