From: Antoine Musso Date: Mon, 28 Jan 2013 10:27:15 +0000 (+0100) Subject: pass codesniffer on tests/ X-Git-Tag: 1.31.0-rc.0~20870^2 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=0fd05285d768d8db8bf3de2c4f84a3b2aed467ed;p=lhc%2Fweb%2Fwiklou.git pass codesniffer on tests/ Fix almost all occurences of the following sniffs: Generic.CodeAnalysis.UselessOverridingMethod.Found Generic.Formatting.NoSpaceAfterCast.SpaceFound Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine Generic.PHP.LowerCaseConstant.Found PSR2.Classes.PropertyDeclaration.ScopeMissing PSR2.Files.EndFileNewline.TooMany PSR2.Methods.MethodDeclaration.StaticBeforeVisibility Change-Id: I96aacef5bafe5a2bca659744fba1380999cfc37d --- diff --git a/tests/phpunit/MediaWikiPHPUnitCommand.php b/tests/phpunit/MediaWikiPHPUnitCommand.php index 3894435d99..0434bb3fcc 100644 --- a/tests/phpunit/MediaWikiPHPUnitCommand.php +++ b/tests/phpunit/MediaWikiPHPUnitCommand.php @@ -2,7 +2,7 @@ class MediaWikiPHPUnitCommand extends PHPUnit_TextUI_Command { - static $additionalOptions = array( + public static $additionalOptions = array( 'regex=' => false, 'file=' => false, 'use-filebackend=' => false, diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index cbf9a8e4fc..19736ee745 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -71,7 +71,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { $this->backupStaticAttributes = false; } - function run( PHPUnit_Framework_TestResult $result = NULL ) { + function run( PHPUnit_Framework_TestResult $result = null ) { /* Some functions require some kind of caching, and will end up using the db, * which we can't allow, as that would open a new connection for mysql. * Replace with a HashBag. They would not be going to persist anyway. @@ -365,7 +365,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { 'page_id' => 0, 'page_namespace' => 0, 'page_title' => ' ', - 'page_restrictions' => NULL, + 'page_restrictions' => null, 'page_counter' => 0, 'page_is_redirect' => 0, 'page_is_new' => 0, @@ -513,12 +513,12 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { return $this->assertTrue( $value == '', $msg ); } - static private function unprefixTable( $tableName ) { + private static function unprefixTable( $tableName ) { global $wgDBprefix; return substr( $tableName, strlen( $wgDBprefix ) ); } - static private function isNotUnittest( $table ) { + private static function isNotUnittest( $table ) { return strpos( $table, 'unittest_' ) !== 0; } diff --git a/tests/phpunit/data/xmp/gps.result.php b/tests/phpunit/data/xmp/gps.result.php index 2d1243d559..8ea9c68ca0 100644 --- a/tests/phpunit/data/xmp/gps.result.php +++ b/tests/phpunit/data/xmp/gps.result.php @@ -9,4 +9,3 @@ $result = array( 'xmp-exif' => 'GPSVersionID' => '2.2.0.0' ) ); - diff --git a/tests/phpunit/includes/BlockTest.php b/tests/phpunit/includes/BlockTest.php index 29931c87cf..bdd4853c23 100644 --- a/tests/phpunit/includes/BlockTest.php +++ b/tests/phpunit/includes/BlockTest.php @@ -167,7 +167,7 @@ class BlockTest extends MediaWikiLangTestCase { // Reload block from DB $userBlock = Block::newFromTarget( $username ); $this->assertTrue( - (bool) $block->prevents( 'createaccount' ), + (bool)$block->prevents( 'createaccount' ), "Block object in DB should prevents 'createaccount'" ); @@ -180,7 +180,7 @@ class BlockTest extends MediaWikiLangTestCase { // Reload user $u = User::newFromName( $username ); $this->assertTrue( - (bool) $u->isBlockedFromCreateAccount(), + (bool)$u->isBlockedFromCreateAccount(), "Our sandbox user '$username' should NOT be able to create account" ); } @@ -223,7 +223,7 @@ class BlockTest extends MediaWikiLangTestCase { $block = Block::newFromID( $res['id'] ); $this->assertEquals( 'UserOnForeignWiki', $block->getTarget()->getName(), 'Correct blockee name' ); - $this->assertEquals( '14146', $block->getTarget()->getId(), 'Correct blockee id' ); + $this->assertEquals( '14146', $block->getTarget()->getId(), 'Correct blockee id' ); $this->assertEquals( 'MetaWikiUser', $block->getBlocker(), 'Correct blocker name' ); $this->assertEquals( 'MetaWikiUser', $block->getByName(), 'Correct blocker name' ); $this->assertEquals( 0, $block->getBy(), 'Correct blocker id' ); diff --git a/tests/phpunit/includes/DiffHistoryBlobTest.php b/tests/phpunit/includes/DiffHistoryBlobTest.php index 361b4124d8..dcd9dddf4c 100644 --- a/tests/phpunit/includes/DiffHistoryBlobTest.php +++ b/tests/phpunit/includes/DiffHistoryBlobTest.php @@ -22,7 +22,7 @@ class DiffHistoryBlobTest extends MediaWikiTestCase { * @dataProvider provideXdiffAdler32 */ function testXdiffAdler32( $input ) { - $xdiffHash = substr( xdiff_string_rabdiff( $input, '' ), 0, 4 ); + $xdiffHash = substr( xdiff_string_rabdiff( $input, '' ), 0, 4 ); $dhb = new DiffHistoryBlob; $myHash = $dhb->xdiffAdler32( $input ); $this->assertSame( bin2hex( $xdiffHash ), bin2hex( $myHash ), diff --git a/tests/phpunit/includes/ExternalStoreTest.php b/tests/phpunit/includes/ExternalStoreTest.php index fe6c60d305..99544e7ed0 100644 --- a/tests/phpunit/includes/ExternalStoreTest.php +++ b/tests/phpunit/includes/ExternalStoreTest.php @@ -78,4 +78,4 @@ class ExternalStoreFOO { return $this->data[$cluster][$id]; } -} \ No newline at end of file +} diff --git a/tests/phpunit/includes/ExtraParserTest.php b/tests/phpunit/includes/ExtraParserTest.php index ca1615e3c7..46aa6fc9ac 100644 --- a/tests/phpunit/includes/ExtraParserTest.php +++ b/tests/phpunit/includes/ExtraParserTest.php @@ -40,7 +40,7 @@ class ExtraParserTest extends MediaWikiTestCase { /* Test the parser entry points */ function testParse() { $title = Title::newFromText( __FUNCTION__ ); - $parserOutput = $this->parser->parse( "Test\n{{Foo}}\n{{Bar}}" , $title, $this->options ); + $parserOutput = $this->parser->parse( "Test\n{{Foo}}\n{{Bar}}", $title, $this->options ); $this->assertEquals( "

Test\nContent of Template:Foo\nContent of Template:Bar\n

", $parserOutput->getText() ); } @@ -54,7 +54,7 @@ class ExtraParserTest extends MediaWikiTestCase { function testPreprocess() { $title = Title::newFromText( __FUNCTION__ ); - $outputText = $this->parser->preprocess( "Test\n{{Foo}}\n{{Bar}}" , $title, $this->options ); + $outputText = $this->parser->preprocess( "Test\n{{Foo}}\n{{Bar}}", $title, $this->options ); $this->assertEquals( "Test\nContent of ''Template:Foo''\nContent of ''Template:Bar''", $outputText ); } @@ -140,7 +140,7 @@ class ExtraParserTest extends MediaWikiTestCase { $catName = wfMessage( 'broken-file-category' )->inContentLanguage()->text(); $cat = Title::makeTitleSafe( NS_CATEGORY, $catName ); $expected = array( $cat->getDBkey() ); - $parserOutput = $this->parser->parse( "[[file:nonexistent]]" , $title, $this->options ); + $parserOutput = $this->parser->parse( "[[file:nonexistent]]", $title, $this->options ); $result = $parserOutput->getCategoryLinks(); $this->assertEquals( $expected, $result ); } @@ -151,7 +151,7 @@ class ExtraParserTest extends MediaWikiTestCase { function testTrackingCategorySpecial() { // Special pages shouldn't have tracking cats. $title = SpecialPage::getTitleFor( 'Contributions' ); - $parserOutput = $this->parser->parse( "[[file:nonexistent]]" , $title, $this->options ); + $parserOutput = $this->parser->parse( "[[file:nonexistent]]", $title, $this->options ); $result = $parserOutput->getCategoryLinks(); $this->assertEmpty( $result ); } diff --git a/tests/phpunit/includes/FormOptionsInitializationTest.php b/tests/phpunit/includes/FormOptionsInitializationTest.php index af28f79642..99f8fb7fb7 100644 --- a/tests/phpunit/includes/FormOptionsInitializationTest.php +++ b/tests/phpunit/includes/FormOptionsInitializationTest.php @@ -61,12 +61,12 @@ class FormOptionsInitializationTest extends MediaWikiTestCase { } public function testAddIntegers() { - $this->object->add( 'one', 1 ); - $this->object->add( 'negone', -1 ); + $this->object->add( 'one', 1 ); + $this->object->add( 'negone', -1 ); $this->assertEquals( array( 'negone' => array( - 'default' => -1, + 'default' => -1, 'value' => null, 'consumed' => false, 'type' => FormOptions::INT, diff --git a/tests/phpunit/includes/FormOptionsTest.php b/tests/phpunit/includes/FormOptionsTest.php index d4e3c5ef68..bdc5f1259e 100644 --- a/tests/phpunit/includes/FormOptionsTest.php +++ b/tests/phpunit/includes/FormOptionsTest.php @@ -33,8 +33,8 @@ class FormOptionsTest extends MediaWikiTestCase { $this->object = new FormOptions; $this->object->add( 'string1', 'string one' ); $this->object->add( 'string2', 'string two' ); - $this->object->add( 'integer', 0 ); - $this->object->add( 'intnull', 0, FormOptions::INTNULL ); + $this->object->add( 'integer', 0 ); + $this->object->add( 'intnull', 0, FormOptions::INTNULL ); } /** Helpers for testGuessType() */ diff --git a/tests/phpunit/includes/GlobalFunctions/GlobalTest.php b/tests/phpunit/includes/GlobalFunctions/GlobalTest.php index 1a02cb82bb..162970f4c8 100644 --- a/tests/phpunit/includes/GlobalFunctions/GlobalTest.php +++ b/tests/phpunit/includes/GlobalFunctions/GlobalTest.php @@ -686,4 +686,3 @@ class GlobalTest extends MediaWikiTestCase { } /* TODO: many more! */ } - diff --git a/tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php b/tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php index 4c4c4c0495..15f3507027 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php +++ b/tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php @@ -32,4 +32,3 @@ class wfGetCaller extends MediaWikiTestCase { $this->assertEquals( "wfGetCaller::intermediateFunction", self::intermediateFunction( $i + 1, $i ) ); } } - diff --git a/tests/phpunit/includes/HooksTest.php b/tests/phpunit/includes/HooksTest.php index e455f0f2c6..89e789b1b2 100644 --- a/tests/phpunit/includes/HooksTest.php +++ b/tests/phpunit/includes/HooksTest.php @@ -111,7 +111,7 @@ class HooksTest extends MediaWikiTestCase { class NothingClass { public $calls = 0; - static public function someStatic( &$foo, &$bar ) { + public static function someStatic( &$foo, &$bar ) { $foo = 'bah'; return true; } diff --git a/tests/phpunit/includes/HttpTest.php b/tests/phpunit/includes/HttpTest.php index b49de6524a..92a1c9c14b 100644 --- a/tests/phpunit/includes/HttpTest.php +++ b/tests/phpunit/includes/HttpTest.php @@ -54,7 +54,7 @@ class HttpTest extends MediaWikiTestCase { function testIsValidUri( $expect, $URI, $message = '' ) { $this->assertEquals( $expect, - (bool) Http::isValidURI( $URI ), + (bool)Http::isValidURI( $URI ), $message ); } diff --git a/tests/phpunit/includes/IPTest.php b/tests/phpunit/includes/IPTest.php index c4a6c55c68..5284812bbb 100644 --- a/tests/phpunit/includes/IPTest.php +++ b/tests/phpunit/includes/IPTest.php @@ -119,7 +119,7 @@ class IPTest extends MediaWikiTestCase { $c = sprintf( "%01d", $i ); foreach ( array_unique( array( $a, $b, $c ) ) as $f ) { $ip = "$f.$f.$f.$f"; - $this->assertTrue( IP::isValid( $ip ) , "$ip is a valid IPv4 address" ); + $this->assertTrue( IP::isValid( $ip ), "$ip is a valid IPv4 address" ); } } foreach ( range( 0x0, 0xFFFF, 0xF ) as $i ) { @@ -128,7 +128,7 @@ class IPTest extends MediaWikiTestCase { $c = sprintf( "%02x", $i ); foreach ( array_unique( array( $a, $b, $c ) ) as $f ) { $ip = "$f:$f:$f:$f:$f:$f:$f:$f"; - $this->assertTrue( IP::isValid( $ip ) , "$ip is a valid IPv6 address" ); + $this->assertTrue( IP::isValid( $ip ), "$ip is a valid IPv6 address" ); } } // test with some abbreviations @@ -173,7 +173,7 @@ class IPTest extends MediaWikiTestCase { $c = sprintf( "%02s", $i ); foreach ( array_unique( array( $a, $b, $c ) ) as $f ) { $ip = "$f:$f:$f:$f:$f:$f:$f:$f"; - $this->assertFalse( IP::isValid( $ip ) , "$ip is not a valid IPv6 address" ); + $this->assertFalse( IP::isValid( $ip ), "$ip is not a valid IPv6 address" ); } } // Have CIDR @@ -264,7 +264,7 @@ class IPTest extends MediaWikiTestCase { */ public function testip2longWrapper() { // @todo FIXME: Add more tests ? - $this->assertEquals( pow(2,32) - 1, IP::toUnsigned( '255.255.255.255' )); + $this->assertEquals( pow(2,32) - 1, IP::toUnsigned( '255.255.255.255' ) ); $i = 'IN.VA.LI.D'; $this->assertFalse( IP::toUnSigned( $i ) ); } diff --git a/tests/phpunit/includes/LinksUpdateTest.php b/tests/phpunit/includes/LinksUpdateTest.php index 332588587a..244e4a8d42 100644 --- a/tests/phpunit/includes/LinksUpdateTest.php +++ b/tests/phpunit/includes/LinksUpdateTest.php @@ -160,4 +160,3 @@ class LinksUpdateTest extends MediaWikiTestCase { $this->assertSelect( $table, $fields, $condition, $expectedRows ); } } - diff --git a/tests/phpunit/includes/LocalFileTest.php b/tests/phpunit/includes/LocalFileTest.php index c5a9dc198e..7b64a33166 100644 --- a/tests/phpunit/includes/LocalFileTest.php +++ b/tests/phpunit/includes/LocalFileTest.php @@ -105,5 +105,3 @@ class LocalFileTest extends MediaWikiTestCase { $this->assertThat( $file, $this->isInstanceOf( 'LocalFile' ), 'wfLocalFile() returns LocalFile for valid Titles' ); } } - - diff --git a/tests/phpunit/includes/MWNamespaceTest.php b/tests/phpunit/includes/MWNamespaceTest.php index 01d406a0d0..d0b3814ba5 100644 --- a/tests/phpunit/includes/MWNamespaceTest.php +++ b/tests/phpunit/includes/MWNamespaceTest.php @@ -570,4 +570,3 @@ class MWNamespaceTest extends MediaWikiTestCase { $this->assertFalse( MWNamespace::subjectEquals( $ns1, $ns2, $msg ) ); } } - diff --git a/tests/phpunit/includes/RevisionStorageTest.php b/tests/phpunit/includes/RevisionStorageTest.php index 4fa42f35a2..1301bf375f 100644 --- a/tests/phpunit/includes/RevisionStorageTest.php +++ b/tests/phpunit/includes/RevisionStorageTest.php @@ -127,8 +127,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::__construct */ - public function testConstructFromRow() - { + public function testConstructFromRow() { $orig = $this->makeRevision(); $dbr = wfgetDB( DB_SLAVE ); @@ -146,8 +145,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::newFromRow */ - public function testNewFromRow() - { + public function testNewFromRow() { $orig = $this->makeRevision(); $dbr = wfgetDB( DB_SLAVE ); @@ -166,8 +164,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::newFromArchiveRow */ - public function testNewFromArchiveRow() - { + public function testNewFromArchiveRow() { $page = $this->createPage( 'RevisionStorageTest_testNewFromArchiveRow', 'Lorem Ipsum', CONTENT_MODEL_WIKITEXT ); $orig = $page->getRevision(); $page->doDeleteArticle( 'test Revision::newFromArchiveRow' ); @@ -187,8 +184,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::newFromId */ - public function testNewFromId() - { + public function testNewFromId() { $orig = $this->makeRevision(); $rev = Revision::newFromId( $orig->getId() ); @@ -199,8 +195,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::fetchRevision */ - public function testFetchRevision() - { + public function testFetchRevision() { $page = $this->createPage( 'RevisionStorageTest_testFetchRevision', 'one', CONTENT_MODEL_WIKITEXT ); $id1 = $page->getRevision()->getId(); @@ -223,8 +218,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::selectFields */ - public function testSelectFields() - { + public function testSelectFields() { global $wgContentHandlerUseDB; $fields = Revision::selectFields(); @@ -245,8 +239,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::getPage */ - public function testGetPage() - { + public function testGetPage() { $page = $this->the_page; $orig = $this->makeRevision( array( 'page' => $page->getId() ) ); @@ -258,8 +251,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::getText */ - public function testGetText() - { + public function testGetText() { $this->hideDeprecated( 'Revision::getText' ); $orig = $this->makeRevision( array( 'text' => 'hello hello.' ) ); @@ -271,8 +263,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::getContent */ - public function testGetContent_failure() - { + public function testGetContent_failure() { $rev = new Revision( array( 'page' => $this->the_page->getId(), 'content_model' => $this->the_page->getContentModel(), @@ -290,8 +281,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::getContent */ - public function testGetContent() - { + public function testGetContent() { $orig = $this->makeRevision( array( 'text' => 'hello hello.' ) ); $rev = Revision::newFromId( $orig->getId() ); @@ -301,8 +291,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::revText */ - public function testRevText() - { + public function testRevText() { $this->hideDeprecated( 'Revision::revText' ); $orig = $this->makeRevision( array( 'text' => 'hello hello rev.' ) ); $rev = Revision::newFromId( $orig->getId() ); @@ -313,8 +302,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::getRawText */ - public function testGetRawText() - { + public function testGetRawText() { $this->hideDeprecated( 'Revision::getRawText' ); $orig = $this->makeRevision( array( 'text' => 'hello hello raw.' ) ); @@ -326,8 +314,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::getContentModel */ - public function testGetContentModel() - { + public function testGetContentModel() { global $wgContentHandlerUseDB; if ( !$wgContentHandlerUseDB ) { @@ -344,8 +331,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::getContentFormat */ - public function testGetContentFormat() - { + public function testGetContentFormat() { global $wgContentHandlerUseDB; if ( !$wgContentHandlerUseDB ) { @@ -363,8 +349,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::isCurrent */ - public function testIsCurrent() - { + public function testIsCurrent() { $page = $this->createPage( 'RevisionStorageTest_testIsCurrent', 'Lorem Ipsum', CONTENT_MODEL_WIKITEXT ); $rev1 = $page->getRevision(); @@ -390,8 +375,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::getPrevious */ - public function testGetPrevious() - { + public function testGetPrevious() { $page = $this->createPage( 'RevisionStorageTest_testGetPrevious', 'Lorem Ipsum testGetPrevious', CONTENT_MODEL_WIKITEXT ); $rev1 = $page->getRevision(); @@ -408,8 +392,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::getNext */ - public function testGetNext() - { + public function testGetNext() { $page = $this->createPage( 'RevisionStorageTest_testGetNext', 'Lorem Ipsum testGetNext', CONTENT_MODEL_WIKITEXT ); $rev1 = $page->getRevision(); @@ -426,8 +409,7 @@ class RevisionStorageTest extends MediaWikiTestCase { /** * @covers Revision::newNullRevision */ - public function testNewNullRevision() - { + public function testNewNullRevision() { $page = $this->createPage( 'RevisionStorageTest_testNewNullRevision', 'some testing text', CONTENT_MODEL_WIKITEXT ); $orig = $page->getRevision(); diff --git a/tests/phpunit/includes/RevisionStorageTest_ContentHandlerUseDB.php b/tests/phpunit/includes/RevisionStorageTest_ContentHandlerUseDB.php index c372c3eab4..d0cdfc6908 100644 --- a/tests/phpunit/includes/RevisionStorageTest_ContentHandlerUseDB.php +++ b/tests/phpunit/includes/RevisionStorageTest_ContentHandlerUseDB.php @@ -93,5 +93,3 @@ class RevisionTest_ContentHandlerUseDB extends RevisionStorageTest { } } - - diff --git a/tests/phpunit/includes/RevisionTest.php b/tests/phpunit/includes/RevisionTest.php index 9cddbe827e..33761d29d2 100644 --- a/tests/phpunit/includes/RevisionTest.php +++ b/tests/phpunit/includes/RevisionTest.php @@ -313,8 +313,7 @@ class RevisionTest extends MediaWikiTestCase { * @group Database * @dataProvider dataGetSize */ - public function testGetSize( $text, $model, $expected_size ) - { + public function testGetSize( $text, $model, $expected_size ) { $rev = $this->newTestRevision( $text, 'RevisionTest_testGetSize', $model ); $this->assertEquals( $expected_size, $rev->getSize() ); } @@ -331,8 +330,7 @@ class RevisionTest extends MediaWikiTestCase { * @group Database * @dataProvider dataGetSha1 */ - public function testGetSha1( $text, $model, $expected_hash ) - { + public function testGetSha1( $text, $model, $expected_hash ) { $rev = $this->newTestRevision( $text, 'RevisionTest_testGetSha1', $model ); $this->assertEquals( $expected_hash, $rev->getSha1() ); } diff --git a/tests/phpunit/includes/SampleTest.php b/tests/phpunit/includes/SampleTest.php index 88bbc070df..1439e44580 100644 --- a/tests/phpunit/includes/SampleTest.php +++ b/tests/phpunit/includes/SampleTest.php @@ -103,4 +103,3 @@ class TestSample extends MediaWikiLangTestCase { $this->assertEquals( "Test", $title->isLocal() ); } } - diff --git a/tests/phpunit/includes/SanitizerTest.php b/tests/phpunit/includes/SanitizerTest.php index 28e2e30760..2d039d9f41 100644 --- a/tests/phpunit/includes/SanitizerTest.php +++ b/tests/phpunit/includes/SanitizerTest.php @@ -226,4 +226,3 @@ class SanitizerTest extends MediaWikiTestCase { ); } } - diff --git a/tests/phpunit/includes/SeleniumConfigurationTest.php b/tests/phpunit/includes/SeleniumConfigurationTest.php index 8f6aafa36a..3989fad5e7 100644 --- a/tests/phpunit/includes/SeleniumConfigurationTest.php +++ b/tests/phpunit/includes/SeleniumConfigurationTest.php @@ -161,7 +161,7 @@ testBrowser = "firefox" SeleniumConfig::getSeleniumSettings($seleniumSettings, $seleniumBrowsers, $seleniumTestSuites); - $this->assertEquals($seleniumSettings, $this->testSettings0 , + $this->assertEquals($seleniumSettings, $this->testSettings0, 'The selenium settings should have been read from the file defined in $wgSeleniumConfigFile' ); $this->assertEquals($seleniumBrowsers, $this->testBrowsers0, @@ -207,7 +207,7 @@ testBrowser = "firefox" private function writeToTempFile($textToWrite) { $this->tempFileName = tempnam(sys_get_temp_dir(), 'test_settings.'); $tempFile = fopen( $this->tempFileName, "w" ); - fwrite($tempFile , $textToWrite); + fwrite($tempFile, $textToWrite); fclose($tempFile); } diff --git a/tests/phpunit/includes/SiteConfigurationTest.php b/tests/phpunit/includes/SiteConfigurationTest.php index 27c0bb5114..fc7d8d09e9 100644 --- a/tests/phpunit/includes/SiteConfigurationTest.php +++ b/tests/phpunit/includes/SiteConfigurationTest.php @@ -306,7 +306,7 @@ class SiteConfigurationTest extends MediaWikiTestCase { $this->assertEquals( $getall['simple'], $GLOBALS['simple'], 'extractAllGlobals(): simple setting' ); $this->assertEquals( $getall['fallback'], $GLOBALS['fallback'], 'extractAllGlobals(): fallback setting' ); $this->assertEquals( $getall['params'], $GLOBALS['params'], 'extractAllGlobals(): parameter replacement' ); - $this->assertEquals( $getall['global'], $GLOBALS['global'], 'extractAllGlobals(): merging with global' ); - $this->assertEquals( $getall['merge'], $GLOBALS['merge'], 'extractAllGlobals(): merging setting' ); + $this->assertEquals( $getall['global'], $GLOBALS['global'], 'extractAllGlobals(): merging with global' ); + $this->assertEquals( $getall['merge'], $GLOBALS['merge'], 'extractAllGlobals(): merging setting' ); } } diff --git a/tests/phpunit/includes/TimestampTest.php b/tests/phpunit/includes/TimestampTest.php index d7da0dbe18..de2f855ef5 100644 --- a/tests/phpunit/includes/TimestampTest.php +++ b/tests/phpunit/includes/TimestampTest.php @@ -29,7 +29,7 @@ class TimestampTest extends MediaWikiTestCase { */ function testValidOutput( $format, $expected, $original ) { $timestamp = new MWTimestamp( $original ); - $this->assertEquals( $expected, (string) $timestamp->getTimestamp( $format ) ); + $this->assertEquals( $expected, (string)$timestamp->getTimestamp( $format ) ); } /** diff --git a/tests/phpunit/includes/UserTest.php b/tests/phpunit/includes/UserTest.php index e5a014d21c..a9dfca1d6d 100644 --- a/tests/phpunit/includes/UserTest.php +++ b/tests/phpunit/includes/UserTest.php @@ -175,7 +175,7 @@ class UserTest extends MediaWikiTestCase { // let the user have a few (3) edits $page = WikiPage::factory( Title::newFromText( 'Help:UserTest_EditCount' ) ); for( $i = 0; $i < 3; $i++ ) { - $page->doEdit( (string) $i, 'test', 0, false, $user ); + $page->doEdit( (string)$i, 'test', 0, false, $user ); } $user->clearInstanceCache(); diff --git a/tests/phpunit/includes/WikiPageTest.php b/tests/phpunit/includes/WikiPageTest.php index 9300d4bd2a..46e0f9ddae 100644 --- a/tests/phpunit/includes/WikiPageTest.php +++ b/tests/phpunit/includes/WikiPageTest.php @@ -1011,4 +1011,3 @@ more stuff } } - diff --git a/tests/phpunit/includes/WikiPageTest_ContentHandlerUseDB.php b/tests/phpunit/includes/WikiPageTest_ContentHandlerUseDB.php index 1af6806b79..1d937e9ba4 100644 --- a/tests/phpunit/includes/WikiPageTest_ContentHandlerUseDB.php +++ b/tests/phpunit/includes/WikiPageTest_ContentHandlerUseDB.php @@ -60,5 +60,3 @@ class WikiPageTest_ContentHandlerUseDB extends WikiPageTest { } } - - diff --git a/tests/phpunit/includes/api/ApiTestCaseUpload.php b/tests/phpunit/includes/api/ApiTestCaseUpload.php index 9f281bd6db..458bea458c 100644 --- a/tests/phpunit/includes/api/ApiTestCaseUpload.php +++ b/tests/phpunit/includes/api/ApiTestCaseUpload.php @@ -108,19 +108,19 @@ abstract class ApiTestCaseUpload extends ApiTestCase { } - function fakeUploadChunk( $fieldName, $fileName, $type, & $chunkData ){ + function fakeUploadChunk( $fieldName, $fileName, $type, & $chunkData ) { $tmpName = tempnam( wfTempDir(), "" ); - // copy the chunk data to temp location: + // copy the chunk data to temp location: if ( !file_put_contents( $tmpName, $chunkData ) ) { throw new Exception( "couldn't copy chunk data to $tmpName" ); } - + clearstatcache(); $size = filesize( $tmpName ); if ( $size === false ) { throw new Exception( "couldn't stat $tmpName" ); } - + $_FILES[ $fieldName ] = array( 'name' => $fileName, 'type' => $type, diff --git a/tests/phpunit/includes/api/format/ApiFormatPhpTest.php b/tests/phpunit/includes/api/format/ApiFormatPhpTest.php index d34e7998ee..a59983d8da 100644 --- a/tests/phpunit/includes/api/format/ApiFormatPhpTest.php +++ b/tests/phpunit/includes/api/format/ApiFormatPhpTest.php @@ -8,13 +8,12 @@ class ApiFormatPhpTest extends ApiFormatTestBase { function testValidPhpSyntax() { - + $data = $this->apiRequest( 'php', array( 'action' => 'query', 'meta' => 'siteinfo' ) ); - + $this->assertInternalType( 'array', unserialize( $data ) ); - $this->assertGreaterThan( 0, count( (array) $data ) ); - - + $this->assertGreaterThan( 0, count( (array)$data ) ); + } } diff --git a/tests/phpunit/includes/api/generateRandomImages.php b/tests/phpunit/includes/api/generateRandomImages.php index ee34562325..a05428388a 100644 --- a/tests/phpunit/includes/api/generateRandomImages.php +++ b/tests/phpunit/includes/api/generateRandomImages.php @@ -47,5 +47,3 @@ class GenerateRandomImages extends Maintenance { $maintClass = 'GenerateRandomImages'; require( RUN_MAINTENANCE_IF_MAIN ); - - diff --git a/tests/phpunit/includes/content/ContentHandlerTest.php b/tests/phpunit/includes/content/ContentHandlerTest.php index 73d0012f3f..e12c8c7f6a 100644 --- a/tests/phpunit/includes/content/ContentHandlerTest.php +++ b/tests/phpunit/includes/content/ContentHandlerTest.php @@ -103,7 +103,7 @@ class ContentHandlerTest extends MediaWikiTestCase { if ( $expected ) { $this->assertNotNull( $name, "no name found for content model $id" ); - $this->assertTrue( preg_match( $expected, $name ) > 0 , + $this->assertTrue( preg_match( $expected, $name ) > 0, "content model name for #$id did not match pattern $expected" ); } else { @@ -361,8 +361,7 @@ class DummyContentForTesting extends AbstractContent { * @return mixed the native representation of the content. Could be a string, a nested array * structure, an object, a binary blob... anything, really. */ - public function getNativeData() - { + public function getNativeData() { return $this->data; } @@ -415,7 +414,7 @@ class DummyContentForTesting extends AbstractContent { * * @return ParserOutput */ - public function getParserOutput( Title $title, $revId = null, ParserOptions $options = NULL, $generateHtml = true ) { + public function getParserOutput( Title $title, $revId = null, ParserOptions $options = null, $generateHtml = true ) { return new ParserOutput( $this->getNativeData() ); } } diff --git a/tests/phpunit/includes/db/DatabaseSQLTest.php b/tests/phpunit/includes/db/DatabaseSQLTest.php index 51127f85f8..9a62abc920 100644 --- a/tests/phpunit/includes/db/DatabaseSQLTest.php +++ b/tests/phpunit/includes/db/DatabaseSQLTest.php @@ -145,4 +145,4 @@ class DatabaseSQLTest extends MediaWikiTestCase { ), ); } -} \ No newline at end of file +} diff --git a/tests/phpunit/includes/db/DatabaseSqliteTest.php b/tests/phpunit/includes/db/DatabaseSqliteTest.php index a391fc57ec..db369fc8ef 100644 --- a/tests/phpunit/includes/db/DatabaseSqliteTest.php +++ b/tests/phpunit/includes/db/DatabaseSqliteTest.php @@ -12,7 +12,10 @@ class MockDatabaseSqlite extends DatabaseSqliteStandalone { return true; } - function replaceVars( $s ) { + /** + * Override parent visibility to public + */ + public function replaceVars( $s ) { return parent::replaceVars( $s ); } } diff --git a/tests/phpunit/includes/db/DatabaseTest.php b/tests/phpunit/includes/db/DatabaseTest.php index cbbdc1f4b8..8c992c7c77 100644 --- a/tests/phpunit/includes/db/DatabaseTest.php +++ b/tests/phpunit/includes/db/DatabaseTest.php @@ -210,5 +210,3 @@ class DatabaseTest extends MediaWikiTestCase { ); } } - - diff --git a/tests/phpunit/includes/db/ORMRowTest.php b/tests/phpunit/includes/db/ORMRowTest.php index 8516241458..596d0bd088 100644 --- a/tests/phpunit/includes/db/ORMRowTest.php +++ b/tests/phpunit/includes/db/ORMRowTest.php @@ -43,19 +43,19 @@ abstract class ORMRowTest extends \MediaWikiTestCase { * @since 1.20 * @return string */ - protected abstract function getRowClass(); + abstract protected function getRowClass(); /** * @since 1.20 * @return IORMTable */ - protected abstract function getTableInstance(); + abstract protected function getTableInstance(); /** * @since 1.20 * @return array */ - public abstract function constructorTestProvider(); + abstract public function constructorTestProvider(); /** * @since 1.20 @@ -222,4 +222,4 @@ abstract class ORMRowTest extends \MediaWikiTestCase { // TODO: test all of the methods! -} \ No newline at end of file +} diff --git a/tests/phpunit/includes/filebackend/FileBackendTest.php b/tests/phpunit/includes/filebackend/FileBackendTest.php index 0cb810535c..b0e07f272b 100644 --- a/tests/phpunit/includes/filebackend/FileBackendTest.php +++ b/tests/phpunit/includes/filebackend/FileBackendTest.php @@ -799,7 +799,7 @@ class FileBackendTest extends MediaWikiTestCase { $status = $this->prepare( array( 'dir' => dirname( $path ) ) ); $this->assertGoodStatus( $status, "Preparing $path succeeded without warnings ($backendName)." ); - $ops[] = array( 'op' => 'create', 'dst' => $path, 'content' => mt_rand(0,50000) ); + $ops[] = array( 'op' => 'create', 'dst' => $path, 'content' => mt_rand(0, 50000) ); $purgeOps[] = array( 'op' => 'delete', 'src' => $path ); } $purgeOps[] = array( 'op' => 'null' ); diff --git a/tests/phpunit/includes/filerepo/StoreBatchTest.php b/tests/phpunit/includes/filerepo/StoreBatchTest.php index 7d815e9a67..5f01c70440 100644 --- a/tests/phpunit/includes/filerepo/StoreBatchTest.php +++ b/tests/phpunit/includes/filerepo/StoreBatchTest.php @@ -84,7 +84,7 @@ class StoreBatchTest extends MediaWikiTestCase { $f = $this->storeit( $fn, $infn, 0 ); $this->assertTrue( $f->isOK(), 'failed to store a new file' ); $this->assertEquals( $f->failCount, 0, "counts wrong {$f->successCount} {$f->failCount}" ); - $this->assertEquals( $f->successCount, 1 , "counts wrong {$f->successCount} {$f->failCount}" ); + $this->assertEquals( $f->successCount, 1, "counts wrong {$f->successCount} {$f->failCount}" ); if ( $fromrepo ) { $f = $this->storeit( "Other-$fn", $infn, FileRepo::OVERWRITE); $infn = $f->value; @@ -93,17 +93,17 @@ class StoreBatchTest extends MediaWikiTestCase { $f = $this->storeit( $fn, $infn, FileRepo::OVERWRITE ); $this->assertTrue( $f->isOK(), 'We should be allowed to overwrite' ); $this->assertEquals( $f->failCount, 0, "counts wrong {$f->successCount} {$f->failCount}" ); - $this->assertEquals( $f->successCount, 1 , "counts wrong {$f->successCount} {$f->failCount}" ); + $this->assertEquals( $f->successCount, 1, "counts wrong {$f->successCount} {$f->failCount}" ); // This should fail because we're overwriting. $f = $this->storeit( $fn, $infn, 0 ); $this->assertFalse( $f->isOK(), 'We should not be allowed to overwrite' ); $this->assertEquals( $f->failCount, 1, "counts wrong {$f->successCount} {$f->failCount}" ); - $this->assertEquals( $f->successCount, 0 , "counts wrong {$f->successCount} {$f->failCount}" ); + $this->assertEquals( $f->successCount, 0, "counts wrong {$f->successCount} {$f->failCount}" ); // This should succeed because we're overwriting the same content. $f = $this->storeit( $fn, $infn, FileRepo::OVERWRITE_SAME ); $this->assertTrue( $f->isOK(), 'We should be able to overwrite the same content' ); $this->assertEquals( $f->failCount, 0, "counts wrong {$f->successCount} {$f->failCount}" ); - $this->assertEquals( $f->successCount, 1 , "counts wrong {$f->successCount} {$f->failCount}" ); + $this->assertEquals( $f->successCount, 1, "counts wrong {$f->successCount} {$f->failCount}" ); // This should fail because we're overwriting different content. if ( $fromrepo ) { $f = $this->storeit( "Other-$fn", $otherfn, FileRepo::OVERWRITE); @@ -112,7 +112,7 @@ class StoreBatchTest extends MediaWikiTestCase { $f = $this->storeit( $fn, $otherfn, FileRepo::OVERWRITE_SAME ); $this->assertFalse( $f->isOK(), 'We should not be allowed to overwrite different content' ); $this->assertEquals( $f->failCount, 1, "counts wrong {$f->successCount} {$f->failCount}" ); - $this->assertEquals( $f->successCount, 0 , "counts wrong {$f->successCount} {$f->failCount}" ); + $this->assertEquals( $f->successCount, 0, "counts wrong {$f->successCount} {$f->failCount}" ); } public function teststore() { diff --git a/tests/phpunit/includes/libs/GenericArrayObjectTest.php b/tests/phpunit/includes/libs/GenericArrayObjectTest.php index c0f8a96ce1..3bbf3aa33a 100644 --- a/tests/phpunit/includes/libs/GenericArrayObjectTest.php +++ b/tests/phpunit/includes/libs/GenericArrayObjectTest.php @@ -36,7 +36,7 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase { * * @return array */ - public abstract function elementInstancesProvider(); + abstract public function elementInstancesProvider(); /** * Returns the name of the concrete class being tested. @@ -45,7 +45,7 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase { * * @return string */ - public abstract function getInstanceClass(); + abstract public function getInstanceClass(); /** * Provides instances of the concrete class being tested. diff --git a/tests/phpunit/includes/logging/LogTests.i18n.php b/tests/phpunit/includes/logging/LogTests.i18n.php index 8a0a42174f..c074696411 100755 --- a/tests/phpunit/includes/logging/LogTests.i18n.php +++ b/tests/phpunit/includes/logging/LogTests.i18n.php @@ -12,4 +12,4 @@ $messages['en'] = array( 'log-description-phpunit' => 'Log for PHPUnit-tests', 'logentry-phpunit-test' => '$1 {{GENDER:$2|tests}} with page $3', 'logentry-phpunit-param' => '$4', -); \ No newline at end of file +); diff --git a/tests/phpunit/includes/media/ExifRotationTest.php b/tests/phpunit/includes/media/ExifRotationTest.php index d52fecc92b..88b2a83b9c 100644 --- a/tests/phpunit/includes/media/ExifRotationTest.php +++ b/tests/phpunit/includes/media/ExifRotationTest.php @@ -222,41 +222,40 @@ class ExifRotationTest extends MediaWikiTestCase { ) ); } - - + + const TEST_WIDTH = 100; const TEST_HEIGHT = 200; - + /** * @dataProvider provideBitmapExtractPreRotationDimensions */ function testBitmapExtractPreRotationDimensions( $rotation, $expected ) { $result = $this->handler->extractPreRotationDimensions( array( - 'physicalWidth' => self::TEST_WIDTH, + 'physicalWidth' => self::TEST_WIDTH, 'physicalHeight' => self::TEST_HEIGHT, ), $rotation ); $this->assertEquals( $expected, $result ); } - + function provideBitmapExtractPreRotationDimensions() { return array( array( 0, - array( self::TEST_WIDTH, self::TEST_HEIGHT ) + array( self::TEST_WIDTH, self::TEST_HEIGHT ) ), array( 90, - array( self::TEST_HEIGHT, self::TEST_WIDTH ) + array( self::TEST_HEIGHT, self::TEST_WIDTH ) ), array( 180, - array( self::TEST_WIDTH, self::TEST_HEIGHT ) + array( self::TEST_WIDTH, self::TEST_HEIGHT ) ), array( 270, - array( self::TEST_HEIGHT, self::TEST_WIDTH ) + array( self::TEST_HEIGHT, self::TEST_WIDTH ) ), ); } } - diff --git a/tests/phpunit/includes/media/MediaHandlerTest.php b/tests/phpunit/includes/media/MediaHandlerTest.php index 99df4f80f9..4e4c649ff3 100644 --- a/tests/phpunit/includes/media/MediaHandlerTest.php +++ b/tests/phpunit/includes/media/MediaHandlerTest.php @@ -46,5 +46,3 @@ class MediaHandlerTest extends MediaWikiTestCase { } } } - - diff --git a/tests/phpunit/includes/media/SVGMetadataExtractorTest.php b/tests/phpunit/includes/media/SVGMetadataExtractorTest.php index d9a59ca6c3..f131972346 100644 --- a/tests/phpunit/includes/media/SVGMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/SVGMetadataExtractorTest.php @@ -106,4 +106,3 @@ class SVGMetadataExtractorTest extends MediaWikiTestCase { ); } } - diff --git a/tests/phpunit/includes/objectcache/BagOStuffTest.php b/tests/phpunit/includes/objectcache/BagOStuffTest.php index ab3d811868..f5264bef4b 100644 --- a/tests/phpunit/includes/objectcache/BagOStuffTest.php +++ b/tests/phpunit/includes/objectcache/BagOStuffTest.php @@ -68,7 +68,7 @@ class BagOStuffTest extends MediaWikiTestCase { * - pcntl_fork is supported by the system * - cache type will correctly support calls over forks */ - $fork = (bool) $this->getCliArg( 'use-bagostuff=' ); + $fork = (bool)$this->getCliArg( 'use-bagostuff=' ); $fork &= function_exists( 'pcntl_fork' ); $fork &= !$this->cache instanceof HashBagOStuff; $fork &= !$this->cache instanceof EmptyBagOStuff; diff --git a/tests/phpunit/includes/parser/MagicVariableTest.php b/tests/phpunit/includes/parser/MagicVariableTest.php index 5f670fc54e..c82ae9beda 100644 --- a/tests/phpunit/includes/parser/MagicVariableTest.php +++ b/tests/phpunit/includes/parser/MagicVariableTest.php @@ -189,7 +189,7 @@ class MagicVariableTest extends MediaWikiTestCase { */ private function assertMagic( $expected, $magic ) { if( in_array( $magic, $this->expectedAsInteger ) ) { - $expected = (int) $expected; + $expected = (int)$expected; } # Generate a message for the assertion diff --git a/tests/phpunit/includes/parser/MediaWikiParserTest.php b/tests/phpunit/includes/parser/MediaWikiParserTest.php index b15365c0c0..013b02c1e3 100644 --- a/tests/phpunit/includes/parser/MediaWikiParserTest.php +++ b/tests/phpunit/includes/parser/MediaWikiParserTest.php @@ -22,7 +22,7 @@ class MediaWikiParserTest { * and then was ucfirst( basename( $filename, '.txt' ) * but that didn't work with names like foo.tests.txt */ - $className = str_replace( '.', '_', ucfirst( $testsName ) ); + $className = str_replace( '.', '_', ucfirst( $testsName ) ); eval( "/** @group Database\n@group Parser\n*/ class $className extends NewParserTest { protected \$file = '" . strtr( $filename, array( "'" => "\\'", '\\' => '\\\\' ) ) . "'; } " ); diff --git a/tests/phpunit/includes/parser/ParserMethodsTest.php b/tests/phpunit/includes/parser/ParserMethodsTest.php index e0f95b68cd..f3a12d0298 100644 --- a/tests/phpunit/includes/parser/ParserMethodsTest.php +++ b/tests/phpunit/includes/parser/ParserMethodsTest.php @@ -30,4 +30,3 @@ class ParserMethodsTest extends MediaWikiLangTestCase { // TODO: Add tests for cleanSig() / cleanSigInSig(), getSection(), replaceSection(), getPreloadText() } - diff --git a/tests/phpunit/includes/parser/PreprocessorTest.php b/tests/phpunit/includes/parser/PreprocessorTest.php index 8b83b674aa..c3a251f42b 100644 --- a/tests/phpunit/includes/parser/PreprocessorTest.php +++ b/tests/phpunit/includes/parser/PreprocessorTest.php @@ -226,4 +226,3 @@ class PreprocessorTest extends MediaWikiTestCase { $this->assertEquals( $this->normalizeXml( $expectedXml ), $this->preprocessToXml( $wikiText ) ); } } - diff --git a/tests/phpunit/includes/site/SiteListTest.php b/tests/phpunit/includes/site/SiteListTest.php index 7b882126fd..0307d4d9ef 100644 --- a/tests/phpunit/includes/site/SiteListTest.php +++ b/tests/phpunit/includes/site/SiteListTest.php @@ -188,4 +188,4 @@ class SiteListTest extends MediaWikiTestCase { } } -} \ No newline at end of file +} diff --git a/tests/phpunit/includes/site/SiteTest.php b/tests/phpunit/includes/site/SiteTest.php index 255e2de380..c11165b48d 100644 --- a/tests/phpunit/includes/site/SiteTest.php +++ b/tests/phpunit/includes/site/SiteTest.php @@ -265,4 +265,4 @@ class SiteTest extends MediaWikiTestCase { $this->assertEquals( $serialization, serialize( $newInstance ) ); } -} \ No newline at end of file +} diff --git a/tests/phpunit/includes/site/TestSites.php b/tests/phpunit/includes/site/TestSites.php index b57fe9f76e..a5656a73f5 100644 --- a/tests/phpunit/includes/site/TestSites.php +++ b/tests/phpunit/includes/site/TestSites.php @@ -98,4 +98,4 @@ class TestSites { $sitesTable->saveSites( TestSites::getSites() ); } -} \ No newline at end of file +} diff --git a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php index 82426bdaa2..11492a10e6 100644 --- a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php +++ b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php @@ -125,5 +125,3 @@ class SpecialRecentchangesTest extends MediaWikiTestCase { } } - - diff --git a/tests/phpunit/includes/specials/SpecialSearchTest.php b/tests/phpunit/includes/specials/SpecialSearchTest.php index 9d7dc716a9..f6652bcc69 100644 --- a/tests/phpunit/includes/specials/SpecialSearchTest.php +++ b/tests/phpunit/includes/specials/SpecialSearchTest.php @@ -138,4 +138,3 @@ class SpecialSearchTest extends MediaWikiTestCase { } } - diff --git a/tests/phpunit/languages/LanguageMlTest.php b/tests/phpunit/languages/LanguageMlTest.php index b7f6182bc4..10ff664882 100644 --- a/tests/phpunit/languages/LanguageMlTest.php +++ b/tests/phpunit/languages/LanguageMlTest.php @@ -11,7 +11,7 @@ class LanguageMlTest extends LanguageClassesTestCase { /** see bug 29495 */ /** @dataProvider providerFormatNum*/ function testFormatNum( $result, $value ) { - $this->assertEquals( $result, $this->getLang()->formatNum( $value ) ); + $this->assertEquals( $result, $this->getLang()->formatNum( $value ) ); } function providerFormatNum() { diff --git a/tests/phpunit/languages/LanguageTest.php b/tests/phpunit/languages/LanguageTest.php index 5594670f30..a6d36778c4 100644 --- a/tests/phpunit/languages/LanguageTest.php +++ b/tests/phpunit/languages/LanguageTest.php @@ -425,14 +425,14 @@ class LanguageTest extends LanguageClassesTestCase { */ function testBuiltInCodeValidation( $code, $message = '' ) { $this->assertTrue( - (bool) Language::isValidBuiltInCode( $code ), + (bool)Language::isValidBuiltInCode( $code ), "validating code $code $message" ); } function testBuiltInCodeValidationRejectUnderscore() { $this->assertFalse( - (bool) Language::isValidBuiltInCode( 'be_tarask' ), + (bool)Language::isValidBuiltInCode( 'be_tarask' ), "reject underscore in language code" ); } @@ -1284,4 +1284,3 @@ class LanguageTest extends LanguageClassesTestCase { ); } } - diff --git a/tests/phpunit/languages/utils/CLDRPluralRuleEvaluatorTest.php b/tests/phpunit/languages/utils/CLDRPluralRuleEvaluatorTest.php index 033164b026..58fcf16002 100644 --- a/tests/phpunit/languages/utils/CLDRPluralRuleEvaluatorTest.php +++ b/tests/phpunit/languages/utils/CLDRPluralRuleEvaluatorTest.php @@ -9,7 +9,7 @@ class CLDRPluralRuleEvaluatorTest extends MediaWikiTestCase { * @dataProvider validTestCases */ function testValidRules( $expected, $rules, $number, $comment ) { - $result = CLDRPluralRuleEvaluator::evaluate( $number, (array) $rules ); + $result = CLDRPluralRuleEvaluator::evaluate( $number, (array)$rules ); $this->assertEquals( $expected, $result, $comment ); } @@ -18,7 +18,7 @@ class CLDRPluralRuleEvaluatorTest extends MediaWikiTestCase { * @expectedException CLDRPluralRuleError */ function testInvalidRules( $rules, $comment ) { - CLDRPluralRuleEvaluator::evaluate( 1, (array) $rules ); + CLDRPluralRuleEvaluator::evaluate( 1, (array)$rules ); } function validTestCases() { diff --git a/tests/phpunit/maintenance/DumpTestCase.php b/tests/phpunit/maintenance/DumpTestCase.php index 0f3a6a1b62..106fab804c 100644 --- a/tests/phpunit/maintenance/DumpTestCase.php +++ b/tests/phpunit/maintenance/DumpTestCase.php @@ -57,7 +57,7 @@ abstract class DumpTestCase extends MediaWikiLangTestCase { */ protected function gunzip( $fname ) { $gzipped_contents = file_get_contents( $fname ); - if ( $gzipped_contents === FALSE ) { + if ( $gzipped_contents === false ) { $this->fail( "Could not get contents of $fname" ); } // We resort to use gzinflate instead of gzdecode, as gzdecode diff --git a/tests/phpunit/maintenance/MaintenanceTest.php b/tests/phpunit/maintenance/MaintenanceTest.php index a0ed745c12..b9c0fb80f5 100644 --- a/tests/phpunit/maintenance/MaintenanceTest.php +++ b/tests/phpunit/maintenance/MaintenanceTest.php @@ -191,44 +191,44 @@ class MaintenanceTest extends MediaWikiTestCase { function testOutputEmpty() { $this->m->output( "" ); - $this->assertOutputPrePostShutdown( "", False ); + $this->assertOutputPrePostShutdown( "", false ); } function testOutputString() { $this->m->output( "foo" ); - $this->assertOutputPrePostShutdown( "foo", False ); + $this->assertOutputPrePostShutdown( "foo", false ); } function testOutputStringString() { $this->m->output( "foo" ); $this->m->output( "bar" ); - $this->assertOutputPrePostShutdown( "foobar", False ); + $this->assertOutputPrePostShutdown( "foobar", false ); } function testOutputStringNL() { $this->m->output( "foo\n" ); - $this->assertOutputPrePostShutdown( "foo\n", False ); + $this->assertOutputPrePostShutdown( "foo\n", false ); } function testOutputStringNLNL() { $this->m->output( "foo\n\n" ); - $this->assertOutputPrePostShutdown( "foo\n\n", False ); + $this->assertOutputPrePostShutdown( "foo\n\n", false ); } function testOutputStringNLString() { $this->m->output( "foo\nbar" ); - $this->assertOutputPrePostShutdown( "foo\nbar", False ); + $this->assertOutputPrePostShutdown( "foo\nbar", false ); } function testOutputStringNLStringNL() { $this->m->output( "foo\nbar\n" ); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testOutputStringNLStringNLLinewise() { $this->m->output( "foo\n" ); $this->m->output( "bar\n" ); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testOutputStringNLStringNLArbitrary() { @@ -239,7 +239,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->output( "ba" ); $this->m->output( "" ); $this->m->output( "r\n" ); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testOutputStringNLStringNLArbitraryAgain() { @@ -250,49 +250,49 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->output( "a" ); $this->m->output( "" ); $this->m->output( "r\n" ); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testOutputWNullChannelEmpty() { $this->m->output( "", null ); - $this->assertOutputPrePostShutdown( "", False ); + $this->assertOutputPrePostShutdown( "", false ); } function testOutputWNullChannelString() { $this->m->output( "foo", null ); - $this->assertOutputPrePostShutdown( "foo", False ); + $this->assertOutputPrePostShutdown( "foo", false ); } function testOutputWNullChannelStringString() { $this->m->output( "foo", null ); $this->m->output( "bar", null ); - $this->assertOutputPrePostShutdown( "foobar", False ); + $this->assertOutputPrePostShutdown( "foobar", false ); } function testOutputWNullChannelStringNL() { $this->m->output( "foo\n", null ); - $this->assertOutputPrePostShutdown( "foo\n", False ); + $this->assertOutputPrePostShutdown( "foo\n", false ); } function testOutputWNullChannelStringNLNL() { $this->m->output( "foo\n\n", null ); - $this->assertOutputPrePostShutdown( "foo\n\n", False ); + $this->assertOutputPrePostShutdown( "foo\n\n", false ); } function testOutputWNullChannelStringNLString() { $this->m->output( "foo\nbar", null ); - $this->assertOutputPrePostShutdown( "foo\nbar", False ); + $this->assertOutputPrePostShutdown( "foo\nbar", false ); } function testOutputWNullChannelStringNLStringNL() { $this->m->output( "foo\nbar\n", null ); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testOutputWNullChannelStringNLStringNLLinewise() { $this->m->output( "foo\n", null ); $this->m->output( "bar\n", null ); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testOutputWNullChannelStringNLStringNLArbitrary() { @@ -303,7 +303,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->output( "ba", null ); $this->m->output( "", null ); $this->m->output( "r\n", null ); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testOutputWNullChannelStringNLStringNLArbitraryAgain() { @@ -314,17 +314,17 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->output( "a", null ); $this->m->output( "", null ); $this->m->output( "r\n", null ); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testOutputWChannelString() { $this->m->output( "foo", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foo", True ); + $this->assertOutputPrePostShutdown( "foo", true ); } function testOutputWChannelStringNL() { $this->m->output( "foo\n", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foo", True ); + $this->assertOutputPrePostShutdown( "foo", true ); } function testOutputWChannelStringNLNL() { @@ -333,23 +333,23 @@ class MaintenanceTest extends MediaWikiTestCase { // outputChanneled with a string ending in a nl ... which is not allowed // according to the documentation of outputChanneled) $this->m->output( "foo\n\n", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foo\n", True ); + $this->assertOutputPrePostShutdown( "foo\n", true ); } function testOutputWChannelStringNLString() { $this->m->output( "foo\nbar", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foo\nbar", True ); + $this->assertOutputPrePostShutdown( "foo\nbar", true ); } function testOutputWChannelStringNLStringNL() { $this->m->output( "foo\nbar\n", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foo\nbar", True ); + $this->assertOutputPrePostShutdown( "foo\nbar", true ); } function testOutputWChannelStringNLStringNLLinewise() { $this->m->output( "foo\n", "bazChannel" ); $this->m->output( "bar\n", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foobar", True ); + $this->assertOutputPrePostShutdown( "foobar", true ); } function testOutputWChannelStringNLStringNLArbitrary() { @@ -360,7 +360,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->output( "ba", "bazChannel" ); $this->m->output( "", "bazChannel" ); $this->m->output( "r\n", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foobar", True ); + $this->assertOutputPrePostShutdown( "foobar", true ); } function testOutputWChannelStringNLStringNLArbitraryAgain() { @@ -371,7 +371,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->output( "a", "bazChannel" ); $this->m->output( "", "bazChannel" ); $this->m->output( "r\n", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foo\nbar", True ); + $this->assertOutputPrePostShutdown( "foo\nbar", true ); } function testOutputWMultipleChannelsChannelChange() { @@ -379,7 +379,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->output( "bar", "bazChannel" ); $this->m->output( "qux", "quuxChannel" ); $this->m->output( "corge", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foobar\nqux\ncorge", True ); + $this->assertOutputPrePostShutdown( "foobar\nqux\ncorge", true ); } function testOutputWMultipleChannelsChannelChangeNL() { @@ -387,7 +387,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->output( "bar\n", "bazChannel" ); $this->m->output( "qux\n", "quuxChannel" ); $this->m->output( "corge", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foobar\nqux\ncorge", True ); + $this->assertOutputPrePostShutdown( "foobar\nqux\ncorge", true ); } function testOutputWAndWOChannelStringStartWO() { @@ -395,7 +395,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->output( "bar", "bazChannel" ); $this->m->output( "qux" ); $this->m->output( "quux", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foobar\nquxquux", True ); + $this->assertOutputPrePostShutdown( "foobar\nquxquux", true ); } function testOutputWAndWOChannelStringStartW() { @@ -403,27 +403,27 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->output( "bar" ); $this->m->output( "qux", "bazChannel" ); $this->m->output( "quux" ); - $this->assertOutputPrePostShutdown( "foo\nbarqux\nquux", False ); + $this->assertOutputPrePostShutdown( "foo\nbarqux\nquux", false ); } function testOutputWChannelTypeSwitch() { $this->m->output( "foo", 1 ); $this->m->output( "bar", 1.0 ); - $this->assertOutputPrePostShutdown( "foo\nbar", True ); + $this->assertOutputPrePostShutdown( "foo\nbar", true ); } function testOutputIntermittentEmpty() { $this->m->output( "foo" ); $this->m->output( "" ); $this->m->output( "bar" ); - $this->assertOutputPrePostShutdown( "foobar", False ); + $this->assertOutputPrePostShutdown( "foobar", false ); } function testOutputIntermittentFalse() { $this->m->output( "foo" ); $this->m->output( false ); $this->m->output( "bar" ); - $this->assertOutputPrePostShutdown( "foobar", False ); + $this->assertOutputPrePostShutdown( "foobar", false ); } function testOutputIntermittentFalseAfterOtherChannel() { @@ -431,35 +431,35 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->output( "foo" ); $this->m->output( false ); $this->m->output( "bar" ); - $this->assertOutputPrePostShutdown( "qux\nfoobar", False ); + $this->assertOutputPrePostShutdown( "qux\nfoobar", false ); } function testOutputWNullChannelIntermittentEmpty() { $this->m->output( "foo", null ); $this->m->output( "", null ); $this->m->output( "bar", null ); - $this->assertOutputPrePostShutdown( "foobar", False ); + $this->assertOutputPrePostShutdown( "foobar", false ); } function testOutputWNullChannelIntermittentFalse() { $this->m->output( "foo", null ); $this->m->output( false, null ); $this->m->output( "bar", null ); - $this->assertOutputPrePostShutdown( "foobar", False ); + $this->assertOutputPrePostShutdown( "foobar", false ); } function testOutputWChannelIntermittentEmpty() { $this->m->output( "foo", "bazChannel" ); $this->m->output( "", "bazChannel" ); $this->m->output( "bar", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foobar", True ); + $this->assertOutputPrePostShutdown( "foobar", true ); } function testOutputWChannelIntermittentFalse() { $this->m->output( "foo", "bazChannel" ); $this->m->output( false, "bazChannel" ); $this->m->output( "bar", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foobar", True ); + $this->assertOutputPrePostShutdown( "foobar", true ); } // Note that (per documentation) outputChanneled does take strings that end @@ -467,23 +467,23 @@ class MaintenanceTest extends MediaWikiTestCase { function testOutputChanneledEmpty() { $this->m->outputChanneled( "" ); - $this->assertOutputPrePostShutdown( "\n", False ); + $this->assertOutputPrePostShutdown( "\n", false ); } function testOutputChanneledString() { $this->m->outputChanneled( "foo" ); - $this->assertOutputPrePostShutdown( "foo\n", False ); + $this->assertOutputPrePostShutdown( "foo\n", false ); } function testOutputChanneledStringString() { $this->m->outputChanneled( "foo" ); $this->m->outputChanneled( "bar" ); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testOutputChanneledStringNLString() { $this->m->outputChanneled( "foo\nbar" ); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testOutputChanneledStringNLStringNLArbitraryAgain() { @@ -494,28 +494,28 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->outputChanneled( "a" ); $this->m->outputChanneled( "" ); $this->m->outputChanneled( "r" ); - $this->assertOutputPrePostShutdown( "\nfoo\n\n\nb\na\n\nr\n", False ); + $this->assertOutputPrePostShutdown( "\nfoo\n\n\nb\na\n\nr\n", false ); } function testOutputChanneledWNullChannelEmpty() { $this->m->outputChanneled( "", null ); - $this->assertOutputPrePostShutdown( "\n", False ); + $this->assertOutputPrePostShutdown( "\n", false ); } function testOutputChanneledWNullChannelString() { $this->m->outputChanneled( "foo", null ); - $this->assertOutputPrePostShutdown( "foo\n", False ); + $this->assertOutputPrePostShutdown( "foo\n", false ); } function testOutputChanneledWNullChannelStringString() { $this->m->outputChanneled( "foo", null ); $this->m->outputChanneled( "bar", null ); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testOutputChanneledWNullChannelStringNLString() { $this->m->outputChanneled( "foo\nbar", null ); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testOutputChanneledWNullChannelStringNLStringNLArbitraryAgain() { @@ -526,23 +526,23 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->outputChanneled( "a", null ); $this->m->outputChanneled( "", null ); $this->m->outputChanneled( "r", null ); - $this->assertOutputPrePostShutdown( "\nfoo\n\n\nb\na\n\nr\n", False ); + $this->assertOutputPrePostShutdown( "\nfoo\n\n\nb\na\n\nr\n", false ); } function testOutputChanneledWChannelString() { $this->m->outputChanneled( "foo", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foo", True ); + $this->assertOutputPrePostShutdown( "foo", true ); } function testOutputChanneledWChannelStringNLString() { $this->m->outputChanneled( "foo\nbar", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foo\nbar", True ); + $this->assertOutputPrePostShutdown( "foo\nbar", true ); } function testOutputChanneledWChannelStringString() { $this->m->outputChanneled( "foo", "bazChannel" ); $this->m->outputChanneled( "bar", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foobar", True ); + $this->assertOutputPrePostShutdown( "foobar", true ); } function testOutputChanneledWChannelStringNLStringNLArbitraryAgain() { @@ -553,7 +553,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->outputChanneled( "a", "bazChannel" ); $this->m->outputChanneled( "", "bazChannel" ); $this->m->outputChanneled( "r", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foo\nbar", True ); + $this->assertOutputPrePostShutdown( "foo\nbar", true ); } function testOutputChanneledWMultipleChannelsChannelChange() { @@ -561,7 +561,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->outputChanneled( "bar", "bazChannel" ); $this->m->outputChanneled( "qux", "quuxChannel" ); $this->m->outputChanneled( "corge", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foobar\nqux\ncorge", True ); + $this->assertOutputPrePostShutdown( "foobar\nqux\ncorge", true ); } function testOutputChanneledWMultipleChannelsChannelChangeEnclosedNull() { @@ -569,7 +569,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->outputChanneled( "bar", null ); $this->m->outputChanneled( "qux", null ); $this->m->outputChanneled( "corge", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foo\nbar\nqux\ncorge", True ); + $this->assertOutputPrePostShutdown( "foo\nbar\nqux\ncorge", true ); } function testOutputChanneledWMultipleChannelsChannelAfterNullChange() { @@ -577,7 +577,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->outputChanneled( "bar", null ); $this->m->outputChanneled( "qux", null ); $this->m->outputChanneled( "corge", "quuxChannel" ); - $this->assertOutputPrePostShutdown( "foo\nbar\nqux\ncorge", True ); + $this->assertOutputPrePostShutdown( "foo\nbar\nqux\ncorge", true ); } function testOutputChanneledWAndWOChannelStringStartWO() { @@ -585,7 +585,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->outputChanneled( "bar", "bazChannel" ); $this->m->outputChanneled( "qux" ); $this->m->outputChanneled( "quux", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foo\nbar\nqux\nquux", True ); + $this->assertOutputPrePostShutdown( "foo\nbar\nqux\nquux", true ); } function testOutputChanneledWAndWOChannelStringStartW() { @@ -593,114 +593,114 @@ class MaintenanceTest extends MediaWikiTestCase { $this->m->outputChanneled( "bar" ); $this->m->outputChanneled( "qux", "bazChannel" ); $this->m->outputChanneled( "quux" ); - $this->assertOutputPrePostShutdown( "foo\nbar\nqux\nquux\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\nqux\nquux\n", false ); } function testOutputChanneledWChannelTypeSwitch() { $this->m->outputChanneled( "foo", 1 ); $this->m->outputChanneled( "bar", 1.0 ); - $this->assertOutputPrePostShutdown( "foo\nbar", True ); + $this->assertOutputPrePostShutdown( "foo\nbar", true ); } function testOutputChanneledWOChannelIntermittentEmpty() { $this->m->outputChanneled( "foo" ); $this->m->outputChanneled( "" ); $this->m->outputChanneled( "bar" ); - $this->assertOutputPrePostShutdown( "foo\n\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\n\nbar\n", false ); } function testOutputChanneledWOChannelIntermittentFalse() { $this->m->outputChanneled( "foo" ); $this->m->outputChanneled( false ); $this->m->outputChanneled( "bar" ); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testOutputChanneledWNullChannelIntermittentEmpty() { $this->m->outputChanneled( "foo", null ); $this->m->outputChanneled( "", null ); $this->m->outputChanneled( "bar", null ); - $this->assertOutputPrePostShutdown( "foo\n\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\n\nbar\n", false ); } function testOutputChanneledWNullChannelIntermittentFalse() { $this->m->outputChanneled( "foo", null ); $this->m->outputChanneled( false, null ); $this->m->outputChanneled( "bar", null ); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testOutputChanneledWChannelIntermittentEmpty() { $this->m->outputChanneled( "foo", "bazChannel" ); $this->m->outputChanneled( "", "bazChannel" ); $this->m->outputChanneled( "bar", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foobar", True ); + $this->assertOutputPrePostShutdown( "foobar", true ); } function testOutputChanneledWChannelIntermittentFalse() { $this->m->outputChanneled( "foo", "bazChannel" ); $this->m->outputChanneled( false, "bazChannel" ); $this->m->outputChanneled( "bar", "bazChannel" ); - $this->assertOutputPrePostShutdown( "foo\nbar", True ); + $this->assertOutputPrePostShutdown( "foo\nbar", true ); } function testCleanupChanneledClean() { $this->m->cleanupChanneled(); - $this->assertOutputPrePostShutdown( "", False ); + $this->assertOutputPrePostShutdown( "", false ); } function testCleanupChanneledAfterOutput() { $this->m->output( "foo" ); $this->m->cleanupChanneled(); - $this->assertOutputPrePostShutdown( "foo", False ); + $this->assertOutputPrePostShutdown( "foo", false ); } function testCleanupChanneledAfterOutputWNullChannel() { $this->m->output( "foo", null ); $this->m->cleanupChanneled(); - $this->assertOutputPrePostShutdown( "foo", False ); + $this->assertOutputPrePostShutdown( "foo", false ); } function testCleanupChanneledAfterOutputWChannel() { $this->m->output( "foo", "bazChannel" ); $this->m->cleanupChanneled(); - $this->assertOutputPrePostShutdown( "foo\n", False ); + $this->assertOutputPrePostShutdown( "foo\n", false ); } function testCleanupChanneledAfterNLOutput() { $this->m->output( "foo\n" ); $this->m->cleanupChanneled(); - $this->assertOutputPrePostShutdown( "foo\n", False ); + $this->assertOutputPrePostShutdown( "foo\n", false ); } function testCleanupChanneledAfterNLOutputWNullChannel() { $this->m->output( "foo\n", null ); $this->m->cleanupChanneled(); - $this->assertOutputPrePostShutdown( "foo\n", False ); + $this->assertOutputPrePostShutdown( "foo\n", false ); } function testCleanupChanneledAfterNLOutputWChannel() { $this->m->output( "foo\n", "bazChannel" ); $this->m->cleanupChanneled(); - $this->assertOutputPrePostShutdown( "foo\n", False ); + $this->assertOutputPrePostShutdown( "foo\n", false ); } function testCleanupChanneledAfterOutputChanneledWOChannel() { $this->m->outputChanneled( "foo" ); $this->m->cleanupChanneled(); - $this->assertOutputPrePostShutdown( "foo\n", False ); + $this->assertOutputPrePostShutdown( "foo\n", false ); } function testCleanupChanneledAfterOutputChanneledWNullChannel() { $this->m->outputChanneled( "foo", null ); $this->m->cleanupChanneled(); - $this->assertOutputPrePostShutdown( "foo\n", False ); + $this->assertOutputPrePostShutdown( "foo\n", false ); } function testCleanupChanneledAfterOutputChanneledWChannel() { $this->m->outputChanneled( "foo", "bazChannel" ); $this->m->cleanupChanneled(); - $this->assertOutputPrePostShutdown( "foo\n", False ); + $this->assertOutputPrePostShutdown( "foo\n", false ); } function testMultipleMaintenanceObjectsInteractionOutput() { @@ -712,7 +712,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->assertEquals( "foobar", $this->getActualOutput(), "Output before shutdown simulation (m2)" ); $m2->simulateShutdown(); - $this->assertOutputPrePostShutdown( "foobar", False ); + $this->assertOutputPrePostShutdown( "foobar", false ); } function testMultipleMaintenanceObjectsInteractionOutputWNullChannel() { @@ -724,7 +724,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->assertEquals( "foobar", $this->getActualOutput(), "Output before shutdown simulation (m2)" ); $m2->simulateShutdown(); - $this->assertOutputPrePostShutdown( "foobar", False ); + $this->assertOutputPrePostShutdown( "foobar", false ); } function testMultipleMaintenanceObjectsInteractionOutputWChannel() { @@ -736,7 +736,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->assertEquals( "foobar", $this->getActualOutput(), "Output before shutdown simulation (m2)" ); $m2->simulateShutdown(); - $this->assertOutputPrePostShutdown( "foobar\n", True ); + $this->assertOutputPrePostShutdown( "foobar\n", true ); } function testMultipleMaintenanceObjectsInteractionOutputWNullChannelNL() { @@ -748,7 +748,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->assertEquals( "foo\nbar\n", $this->getActualOutput(), "Output before shutdown simulation (m2)" ); $m2->simulateShutdown(); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testMultipleMaintenanceObjectsInteractionOutputWChannelNL() { @@ -760,7 +760,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->assertEquals( "foobar", $this->getActualOutput(), "Output before shutdown simulation (m2)" ); $m2->simulateShutdown(); - $this->assertOutputPrePostShutdown( "foobar\n", True ); + $this->assertOutputPrePostShutdown( "foobar\n", true ); } function testMultipleMaintenanceObjectsInteractionOutputChanneled() { @@ -772,7 +772,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->assertEquals( "foo\nbar\n", $this->getActualOutput(), "Output before shutdown simulation (m2)" ); $m2->simulateShutdown(); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testMultipleMaintenanceObjectsInteractionOutputChanneledWNullChannel() { @@ -784,7 +784,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->assertEquals( "foo\nbar\n", $this->getActualOutput(), "Output before shutdown simulation (m2)" ); $m2->simulateShutdown(); - $this->assertOutputPrePostShutdown( "foo\nbar\n", False ); + $this->assertOutputPrePostShutdown( "foo\nbar\n", false ); } function testMultipleMaintenanceObjectsInteractionOutputChanneledWChannel() { @@ -796,7 +796,7 @@ class MaintenanceTest extends MediaWikiTestCase { $this->assertEquals( "foobar", $this->getActualOutput(), "Output before shutdown simulation (m2)" ); $m2->simulateShutdown(); - $this->assertOutputPrePostShutdown( "foobar\n", True ); + $this->assertOutputPrePostShutdown( "foobar\n", true ); } function testMultipleMaintenanceObjectsInteractionCleanupChanneledWChannel() { @@ -815,7 +815,7 @@ class MaintenanceTest extends MediaWikiTestCase { "Output after second cleanup" ); $m2->simulateShutdown(); - $this->assertOutputPrePostShutdown( "foobar\n\n", False ); + $this->assertOutputPrePostShutdown( "foobar\n\n", false ); } diff --git a/tests/phpunit/maintenance/backupTextPassTest.php b/tests/phpunit/maintenance/backupTextPassTest.php index 2ebb351037..5930e9b710 100644 --- a/tests/phpunit/maintenance/backupTextPassTest.php +++ b/tests/phpunit/maintenance/backupTextPassTest.php @@ -156,7 +156,7 @@ class TextPassDumperTest extends DumpTestCase { ); // The mock itself - $prefetchMock = $this->getMock( 'BaseDump', array( 'prefetch' ), array(), '', FALSE ); + $prefetchMock = $this->getMock( 'BaseDump', array( 'prefetch' ), array(), '', false ); $prefetchMock->expects( $this->exactly( 6 ) ) ->method( 'prefetch' ) ->will( $this->returnValueMap( $prefetchMap ) ); @@ -230,7 +230,7 @@ class TextPassDumperTest extends DumpTestCase { $nameOutputDir = $this->getNewTempDirectory(); $stderr = fopen( 'php://output', 'a' ); - if ( $stderr === FALSE ) { + if ( $stderr === false ) { $this->fail( "Could not open stream for stderr" ); } diff --git a/tests/phpunit/maintenance/backup_LogTest.php b/tests/phpunit/maintenance/backup_LogTest.php index 8a8dea5a4d..0aed411f6b 100644 --- a/tests/phpunit/maintenance/backup_LogTest.php +++ b/tests/phpunit/maintenance/backup_LogTest.php @@ -186,7 +186,7 @@ class BackupDumperLoggerTest extends DumpTestCase { // to be able to alert (once dumping produces reports) that this test // needs updates. $dumper->stderr = fopen( 'php://output', 'a' ); - if ( $dumper->stderr === FALSE ) { + if ( $dumper->stderr === false ) { $this->fail( "Could not open stream for stderr" ); } diff --git a/tests/phpunit/maintenance/backup_PageTest.php b/tests/phpunit/maintenance/backup_PageTest.php index 6cdc4ec218..7966fe8349 100644 --- a/tests/phpunit/maintenance/backup_PageTest.php +++ b/tests/phpunit/maintenance/backup_PageTest.php @@ -302,7 +302,7 @@ class BackupDumperPageTest extends DumpTestCase { // computer. We only check that reporting does not crash the dumping // and that something is reported $dumper->stderr = fopen( 'php://output', 'a' ); - if ( $dumper->stderr === FALSE ) { + if ( $dumper->stderr === false ) { $this->fail( "Could not open stream for stderr" ); } diff --git a/tests/phpunit/maintenance/fetchTextTest.php b/tests/phpunit/maintenance/fetchTextTest.php index 8041e3504a..04536f87c5 100644 --- a/tests/phpunit/maintenance/fetchTextTest.php +++ b/tests/phpunit/maintenance/fetchTextTest.php @@ -18,7 +18,7 @@ class SemiMockedFetchText extends FetchText { /** * @var bool Whether or not a text for stdin has been provided */ - private $mockSetUp = False; + private $mockSetUp = false; /** * @var Array Invocation counters for the mocked aspects @@ -32,10 +32,9 @@ class SemiMockedFetchText extends FetchText { * * @param $stdin String The string to be used instead of stdin */ - function mockStdin( $stdin ) - { + function mockStdin( $stdin ) { $this->mockStdinText = $stdin; - $this->mockSetUp = True; + $this->mockSetUp = true; } /** @@ -44,16 +43,14 @@ class SemiMockedFetchText extends FetchText { * @return Array An array, whose keys are function names. The corresponding values * denote the number of times the function has been invoked. */ - function mockGetInvocations() - { + function mockGetInvocations() { return $this->mockInvocations; } // ----------------------------------------------------------------- // Mocked functions from FetchText follow. - function getStdin( $len = null ) - { + function getStdin( $len = null ) { $this->mockInvocations['getStdin']++; if ( $len !== null ) { throw new PHPUnit_Framework_ExpectationFailedException( diff --git a/tests/phpunit/maintenance/getSlaveServerTest.php b/tests/phpunit/maintenance/getSlaveServerTest.php index 0b7c758c75..699571b728 100644 --- a/tests/phpunit/maintenance/getSlaveServerTest.php +++ b/tests/phpunit/maintenance/getSlaveServerTest.php @@ -52,11 +52,11 @@ class GetSlaveServerTest extends MediaWikiTestCase { // The main answer $output = $this->getActualOutput(); - $firstLineEndPos = strpos( $output,"\n"); - if ( $firstLineEndPos === FALSE ) { + $firstLineEndPos = strpos( $output, "\n" ); + if ( $firstLineEndPos === false ) { $this->fail( "Could not find end of first line of output" ); } - $firstLine = substr( $output, 0 , $firstLineEndPos ); + $firstLine = substr( $output, 0, $firstLineEndPos ); $this->assertRegExp( "/^" . self::getServerRE() . "$/D", $firstLine, "DB Server" ); diff --git a/tests/phpunit/skins/SideBarTest.php b/tests/phpunit/skins/SideBarTest.php index 89337f4c6a..85ed0b48cf 100644 --- a/tests/phpunit/skins/SideBarTest.php +++ b/tests/phpunit/skins/SideBarTest.php @@ -10,10 +10,6 @@ class SideBarTest extends MediaWikiLangTestCase { /** Local cache for sidebar messages */ private $messages; - function __construct() { - parent::__construct(); - } - /** Build $this->messages array */ private function initMessagesHref() { # List of default messages for the sidebar: