*/
class ArticleTablesTest extends MediaWikiLangTestCase {
- function testbug14404() {
+ public function testbug14404() {
global $wgContLang, $wgLanguageCode, $wgLang;
$title = Title::newFromText( 'Bug 14404' );
$this->article = null;
}
- function testImplementsGetMagic() {
+ public function testImplementsGetMagic() {
$this->assertEquals( false, $this->article->mLatest, "Article __get magic" );
}
/**
* @depends testImplementsGetMagic
*/
- function testImplementsSetMagic() {
+ public function testImplementsSetMagic() {
$this->article->mLatest = 2;
$this->assertEquals( 2, $this->article->mLatest, "Article __set magic" );
}
/**
* @depends testImplementsSetMagic
*/
- function testImplementsCallMagic() {
+ public function testImplementsCallMagic() {
$this->article->mLatest = 33;
$this->article->mDataLoaded = true;
$this->assertEquals( 33, $this->article->getLatest(), "Article __call magic" );
}
- function testGetOrSetOnNewProperty() {
+ public function testGetOrSetOnNewProperty() {
$this->article->ext_someNewProperty = 12;
$this->assertEquals( 12, $this->article->ext_someNewProperty,
"Article get/set magic on new field" );
/**
* Checks for the existence of the backwards compatibility static functions (forwarders to WikiPage class)
*/
- function testStaticFunctions() {
+ public function testStaticFunctions() {
$this->hideDeprecated( 'Article::getAutosummary' );
$this->hideDeprecated( 'WikiPage::getAutosummary' );
$this->hideDeprecated( 'CategoryPage::getAutosummary' ); // Inherited from Article
"Article static functions" );
}
- function testWikiPageFactory() {
+ public function testWikiPageFactory() {
$title = Title::makeTitle( NS_FILE, 'Someimage.png' );
$page = WikiPage::factory( $title );
$this->assertEquals( 'WikiFilePage', get_class( $page ) );
}
}
- function testInitializerFunctionsReturnCorrectBlock() {
+ public function testInitializerFunctionsReturnCorrectBlock() {
// $this->dumpBlocks();
$this->assertTrue( $this->block->equals( Block::newFromTarget( 'UTBlockee' ) ), "newFromTarget() returns the same block as the one that was made" );
/**
* per bug 26425
*/
- function testBug26425BlockTimestampDefaultsToTime() {
+ public function testBug26425BlockTimestampDefaultsToTime() {
// 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()" );
*
* @dataProvider provideBug29116Data
*/
- function testBug29116LoadWithEmptyIp( $vagueTarget ) {
+ public function testBug29116LoadWithEmptyIp( $vagueTarget ) {
$this->hideDeprecated( 'Block::load' );
$uid = User::idFromName( 'UTBlockee' );
*
* @dataProvider provideBug29116Data
*/
- function testBug29116NewFromTargetWithEmptyIp( $vagueTarget ) {
+ public function testBug29116NewFromTargetWithEmptyIp( $vagueTarget ) {
$block = Block::newFromTarget( 'UTBlockee', $vagueTarget );
$this->assertTrue( $this->block->equals( $block ), "newFromTarget() returns the same block as the one that was made when given empty vagueTarget param " . var_export( $vagueTarget, true ) );
}
);
}
- function testBlockedUserCanNotCreateAccount() {
+ public function testBlockedUserCanNotCreateAccount() {
$username = 'BlockedUserToCreateAccountWith';
$u = User::newFromName( $username );
$u->setPassword( 'NotRandomPass' );
);
}
- function testCrappyCrossWikiBlocks() {
+ public function testCrappyCrossWikiBlocks() {
// Delete the last round's block if it's still there
$oldBlock = Block::newFromTarget( 'UserOnForeignWiki' );
if ( $oldBlock ) {
/**
* @dataProvider providerXff
*/
- function testBlocksOnXff( $xff, $exCount, $exResult ) {
+ public function testBlocksOnXff( $xff, $exCount, $exResult ) {
$list = array_map( 'trim', explode( ',', $xff ) );
$xffblocks = Block::getBlocksForIPList( $list, true );
$this->assertEquals( $exCount, count( $xffblocks ), 'Number of blocks for ' . $xff );
*
* @dataProvider prefixDataProvider
*/
- function testIsPrefix( $lang, $base, $extended ) {
+ public function testIsPrefix( $lang, $base, $extended ) {
$cp = Collator::create( $lang );
$cp->setStrength( Collator::PRIMARY );
$baseBin = $cp->getSortKey( $base );
*
* @dataProvider notPrefixDataProvider
*/
- function testNotIsPrefix( $lang, $base, $extended ) {
+ public function testNotIsPrefix( $lang, $base, $extended ) {
$cp = Collator::create( $lang );
$cp->setStrength( Collator::PRIMARY );
$baseBin = $cp->getSortKey( $base );
*
* @dataProvider firstLetterProvider
*/
- function testGetFirstLetter( $collation, $string, $firstLetter ) {
+ public function testGetFirstLetter( $collation, $string, $firstLetter ) {
$col = Collation::factory( $collation );
$this->assertEquals( $firstLetter, $col->getFirstLetter( $string ) );
}
* Test for DiffHistoryBlob::xdiffAdler32()
* @dataProvider provideXdiffAdler32
*/
- function testXdiffAdler32( $input ) {
+ public function testXdiffAdler32( $input ) {
$xdiffHash = substr( xdiff_string_rabdiff( $input, '' ), 0, 4 );
$dhb = new DiffHistoryBlob;
$myHash = $dhb->xdiffAdler32( $input );
/**
* @dataProvider provideExtractSectionTitle
*/
- function testExtractSectionTitle( $section, $title ) {
+ public function testExtractSectionTitle( $section, $title ) {
$extracted = EditPage::extractSectionTitle( $section );
$this->assertEquals( $title, $extracted );
}
class ExternalStoreTest extends MediaWikiTestCase {
- function testExternalFetchFromURL() {
+ public function testExternalFetchFromURL() {
$this->setMwGlobals( 'wgExternalStores', false );
$this->assertFalse(
}
// Bug 8689 - Long numeric lines kill the parser
- function testBug8689() {
+ public function testBug8689() {
global $wgUser;
$longLine = '1.' . str_repeat( '1234567890', 100000 ) . "\n";
}
/* Test the parser entry points */
- function testParse() {
+ public function testParse() {
$title = Title::newFromText( __FUNCTION__ );
$parserOutput = $this->parser->parse( "Test\n{{Foo}}\n{{Bar}}", $title, $this->options );
$this->assertEquals( "<p>Test\nContent of <i>Template:Foo</i>\nContent of <i>Template:Bar</i>\n</p>", $parserOutput->getText() );
}
- function testPreSaveTransform() {
+ public function testPreSaveTransform() {
global $wgUser;
$title = Title::newFromText( __FUNCTION__ );
$outputText = $this->parser->preSaveTransform( "Test\r\n{{subst:Foo}}\n{{Bar}}", $title, $wgUser, $this->options );
$this->assertEquals( "Test\nContent of ''Template:Foo''\n{{Bar}}", $outputText );
}
- function testPreprocess() {
+ public function testPreprocess() {
$title = Title::newFromText( __FUNCTION__ );
$outputText = $this->parser->preprocess( "Test\n{{Foo}}\n{{Bar}}", $title, $this->options );
/**
* cleanSig() makes all templates substs and removes tildes
*/
- function testCleanSig() {
+ public function testCleanSig() {
$title = Title::newFromText( __FUNCTION__ );
$outputText = $this->parser->cleanSig( "{{Foo}} ~~~~" );
/**
* cleanSig() should do nothing if disabled
*/
- function testCleanSigDisabled() {
+ public function testCleanSigDisabled() {
$this->setMwGlobals( 'wgCleanSignatures', false );
$title = Title::newFromText( __FUNCTION__ );
* cleanSigInSig() just removes tildes
* @dataProvider provideStringsForCleanSigInSig
*/
- function testCleanSigInSig( $in, $out ) {
+ public function testCleanSigInSig( $in, $out ) {
$this->assertEquals( Parser::cleanSigInSig( $in ), $out );
}
);
}
- function testGetSection() {
+ public function testGetSection() {
$outputText2 = $this->parser->getSection( "Section 0\n== Heading 1 ==\nSection 1\n=== Heading 2 ===\nSection 2\n== Heading 3 ==\nSection 3\n", 2 );
$outputText1 = $this->parser->getSection( "Section 0\n== Heading 1 ==\nSection 1\n=== Heading 2 ===\nSection 2\n== Heading 3 ==\nSection 3\n", 1 );
$this->assertEquals( "== Heading 1 ==\nSection 1\n=== Heading 2 ===\nSection 2", $outputText1 );
}
- function testReplaceSection() {
+ public function testReplaceSection() {
$outputText = $this->parser->replaceSection( "Section 0\n== Heading 1 ==\nSection 1\n=== Heading 2 ===\nSection 2\n== Heading 3 ==\nSection 3\n", 1, "New section 1" );
$this->assertEquals( "Section 0\nNew section 1\n\n== Heading 3 ==\nSection 3", $outputText );
/**
* Templates and comments are not affected, but noinclude/onlyinclude is.
*/
- function testGetPreloadText() {
+ public function testGetPreloadText() {
$title = Title::newFromText( __FUNCTION__ );
$outputText = $this->parser->getPreloadText( "{{Foo}}<noinclude> censored</noinclude> information <!-- is very secret -->", $title, $this->options );
/**
* @group Database
*/
- function testTrackingCategory() {
+ public function testTrackingCategory() {
$title = Title::newFromText( __FUNCTION__ );
$catName = wfMessage( 'broken-file-category' )->inContentLanguage()->text();
$cat = Title::makeTitleSafe( NS_CATEGORY, $catName );
/**
* @group Database
*/
- function testTrackingCategorySpecial() {
+ public function testTrackingCategorySpecial() {
// Special pages shouldn't have tracking cats.
$title = SpecialPage::getTitleFor( 'Contributions' );
$parserOutput = $this->parser->parse( "[[file:nonexistent]]", $title, $this->options );
class FauxRequestTest extends MediaWikiTestCase {
- function testGetSetHeader() {
+ public function testGetSetHeader() {
$value = 'test/test';
$request = new FauxRequest();
$this->response = new FauxResponse;
}
- function testCookie() {
+ public function testCookie() {
$this->assertEquals( null, $this->response->getcookie( 'key' ), 'Non-existing cookie' );
$this->response->setcookie( 'key', 'val' );
$this->assertEquals( 'val', $this->response->getcookie( 'key' ), 'Existing cookie' );
}
- function testHeader() {
+ public function testHeader() {
$this->assertEquals( null, $this->response->getheader( 'Location' ), 'Non-existing header' );
$this->response->header( 'Location: http://localhost/' );
$this->assertEquals( 'http://localhost/', $this->response->getheader( 'LOCATION' ), 'Get header case insensitive' );
}
- function testResponseCode() {
+ public function testResponseCode() {
$this->response->header( 'HTTP/1.1 200' );
$this->assertEquals( 200, $this->response->getStatusCode(), 'Header with no message' );
);
}
- function testRandom() {
+ public function testRandom() {
# This could hypothetically fail, but it shouldn't ;)
$this->assertFalse(
wfRandom() == wfRandom() );
}
- function testUrlencode() {
+ public function testUrlencode() {
$this->assertEquals(
"%E7%89%B9%E5%88%A5:Contributions/Foobar",
wfUrlencode( "\xE7\x89\xB9\xE5\x88\xA5:Contributions/Foobar" ) );
}
- function testExpandIRI() {
+ public function testExpandIRI() {
$this->assertEquals(
"https://te.wikibooks.org/wiki/ఉబుంటు_వాడుకరి_మార్గదర్శని",
wfExpandIRI( "https://te.wikibooks.org/wiki/%E0%B0%89%E0%B0%AC%E0%B1%81%E0%B0%82%E0%B0%9F%E0%B1%81_%E0%B0%B5%E0%B0%BE%E0%B0%A1%E0%B1%81%E0%B0%95%E0%B0%B0%E0%B0%BF_%E0%B0%AE%E0%B0%BE%E0%B0%B0%E0%B1%8D%E0%B0%97%E0%B0%A6%E0%B0%B0%E0%B1%8D%E0%B0%B6%E0%B0%A8%E0%B0%BF" ) );
}
- function testReadOnlyEmpty() {
+ public function testReadOnlyEmpty() {
global $wgReadOnly;
$wgReadOnly = null;
$this->assertFalse( wfReadOnly() );
}
- function testReadOnlySet() {
+ public function testReadOnlySet() {
global $wgReadOnly, $wgReadOnlyFile;
$f = fopen( $wgReadOnlyFile, "wt" );
$this->assertFalse( wfReadOnly() );
}
- function testQuotedPrintable() {
+ public function testQuotedPrintable() {
$this->assertEquals(
"=?UTF-8?Q?=C4=88u=20legebla=3F?=",
UserMailer::quotedPrintable( "\xc4\x88u legebla?", "UTF-8" ) );
/**
* @dataProvider provideArrayToCGI
*/
- function testArrayToCGI( $array, $result ) {
+ public function testArrayToCGI( $array, $result ) {
$this->assertEquals( $result, wfArrayToCgi( $array ) );
}
- function testArrayToCGI2() {
+ public function testArrayToCGI2() {
$this->assertEquals(
"baz=bar&foo=bar",
wfArrayToCgi(
/**
* @dataProvider provideCgiToArray
*/
- function testCgiToArray( $cgi, $result ) {
+ public function testCgiToArray( $cgi, $result ) {
$this->assertEquals( $result, wfCgiToArray( $cgi ) );
}
/**
* @dataProvider provideCgiRoundTrip
*/
- function testCgiRoundTrip( $cgi ) {
+ public function testCgiRoundTrip( $cgi ) {
$this->assertEquals( $cgi, wfArrayToCgi( wfCgiToArray( $cgi ) ) );
}
- function testMimeTypeMatch() {
+ public function testMimeTypeMatch() {
$this->assertEquals(
'text/html',
mimeTypeMatch( 'text/html',
'image/svg+xml' => 0.5 ) ) );
}
- function testNegotiateType() {
+ public function testNegotiateType() {
$this->assertEquals(
'text/html',
wfNegotiateType(
array( 'application/xhtml+xml' => 1.0 ) ) );
}
- function testFallbackMbstringFunctions() {
+ public function testFallbackMbstringFunctions() {
if ( !extension_loaded( 'mbstring' ) ) {
$this->markTestSkipped( "The mb_string functions must be installed to test the fallback functions" );
}
- function testDebugFunctionTest() {
+ public function testDebugFunctionTest() {
global $wgDebugLogFile, $wgDebugTimestamps;
$wgDebugTimestamps = $old_wgDebugTimestamps;
}
- function testClientAcceptsGzipTest() {
+ public function testClientAcceptsGzipTest() {
$settings = array(
'gzip' => true,
}
}
- function testSwapVarsTest() {
+ public function testSwapVarsTest() {
$var1 = 1;
$var2 = 2;
$this->assertEquals( $var2, 1, 'var2 is swapped' );
}
- function testWfPercentTest() {
+ public function testWfPercentTest() {
$pcts = array(
array( 6 / 7, '0.86%', 2, false ),
/**
* @dataProvider provideMakeUrlIndexes()
*/
- function testMakeUrlIndexes( $url, $expected ) {
+ public function testMakeUrlIndexes( $url, $expected ) {
$index = wfMakeUrlIndexes( $url );
$this->assertEquals( $expected, $index, "wfMakeUrlIndexes(\"$url\")" );
}
/**
* @dataProvider provideWfMatchesDomainList
*/
- function testWfMatchesDomainList( $url, $domains, $expected, $description ) {
+ public function testWfMatchesDomainList( $url, $domains, $expected, $description ) {
$actual = wfMatchesDomainList( $url, $domains );
$this->assertEquals( $expected, $actual, $description );
}
return $a;
}
- function testWfMkdirParents() {
+ public function testWfMkdirParents() {
// Should not return true if file exists instead of directory
$fname = $this->getNewTempFile();
wfSuppressWarnings();
/**
* @dataProvider provideWfShellMaintenanceCmdList
*/
- function testWfShellMaintenanceCmd( $script, $parameters, $options, $expected, $description ) {
+ public function testWfShellMaintenanceCmd( $script, $parameters, $options, $expected, $description ) {
if ( wfIsWindows() ) {
// Approximation that's good enough for our purposes just now
$expected = str_replace( "'", '"', $expected );
/**
* @dataProvider provideWfIsBadImageList
*/
- function testWfIsBadImage( $name, $title, $blacklist, $expected, $desc ) {
+ public function testWfIsBadImage( $name, $title, $blacklist, $expected, $desc ) {
$this->assertEquals( $expected, wfIsBadImage( $name, $title, $blacklist ), $desc );
}
* @see http://tools.ietf.org/html/bcp47
* @dataProvider provideLanguageCodes()
*/
- function testBCP47( $code, $expected ) {
+ public function testBCP47( $code, $expected ) {
$code = strtolower( $code );
$this->assertEquals( $expected, wfBCP47( $code ),
"Applying BCP47 standard to lower case '$code'"
/**
* @dataProvider providePaths
*/
- function testBaseName( $fullpath, $basename ) {
+ public function testBaseName( $fullpath, $basename ) {
$this->assertEquals( $basename, wfBaseName( $fullpath ),
"wfBaseName('$fullpath') => '$basename'" );
}
class WfGetCallerTest extends MediaWikiTestCase {
- function testZero() {
+ public function testZero() {
$this->assertEquals( __METHOD__, wfGetCaller( 1 ) );
}
return wfGetCaller();
}
- function testOne() {
+ public function testOne() {
$this->assertEquals( 'WfGetCallerTest::testOne', self::callerOne() );
}
return wfGetCaller( $level );
}
- function testTwo() {
+ public function testTwo() {
$this->assertEquals( 'WfGetCallerTest::testTwo', self::intermediateFunction() );
}
- function testN() {
+ public function testN() {
$this->assertEquals( 'WfGetCallerTest::testN', self::intermediateFunction( 2, 0 ) );
$this->assertEquals( 'WfGetCallerTest::intermediateFunction', self::intermediateFunction( 1, 0 ) );
/**
* @dataProvider provideABunchOfShorthands
*/
- function testWfShorthandToInteger( $input, $output, $description ) {
+ public function testWfShorthandToInteger( $input, $output, $description ) {
$this->assertEquals(
wfShorthandToInteger( $input ),
$output,
/**
* @dataProvider provideNormalTimestamps
*/
- function testNormalTimestamps( $input, $format, $output, $desc ) {
+ public function testNormalTimestamps( $input, $format, $output, $desc ) {
$this->assertEquals( $output, wfTimestamp( $format, $input ), $desc );
}
* See r74778 and bug 25451
* @dataProvider provideOldTimestamps
*/
- function testOldTimestamps( $input, $format, $output, $desc ) {
+ public function testOldTimestamps( $input, $format, $output, $desc ) {
$this->assertEquals( $output, wfTimestamp( $format, $input ), $desc );
}
* @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
* @dataProvider provideHttpDates
*/
- function testHttpDate( $input, $output, $desc ) {
+ public function testHttpDate( $input, $output, $desc ) {
$this->assertEquals( $output, wfTimestamp( TS_MW, $input ), $desc );
}
* There are a number of assumptions in our codebase where wfTimestamp()
* should give the current date but it is not given a 0 there. See r71751 CR
*/
- function testTimestampParameter() {
+ public function testTimestampParameter() {
$now = wfTimestamp( TS_UNIX );
// We check that wfTimestamp doesn't return false (error) and use a LessThan assert
// for the cases where the test is run in a second boundary.
* @group HashRing
*/
class HashRingTest extends MediaWikiTestCase {
- function testHashRing() {
+ public function testHashRing() {
$ring = new HashRing( array( 's1' => 1, 's2' => 1, 's3' => 2, 's4' => 2, 's5' => 2, 's6' => 3 ) );
$locations = array();
* Test feature added by r96188, let pass attributes values as
* a PHP array. Restricted to class,rel, accesskey.
*/
- function testExpandAttributesSpaceSeparatedAttributesWithBoolean() {
+ public function testExpandAttributesSpaceSeparatedAttributesWithBoolean() {
$this->assertEquals(
' class="booltrue one"',
Html::expandAttributes( array( 'class' => array(
*
* Feature added by r96188
*/
- function testValueIsAuthoritativeInSpaceSeparatedAttributesArrays() {
+ public function testValueIsAuthoritativeInSpaceSeparatedAttributesArrays() {
$this->assertEquals(
' class=""',
Html::expandAttributes( array( 'class' => array(
);
}
- function testNamespaceSelector() {
+ public function testNamespaceSelector() {
$this->assertEquals(
'<select id=namespace name=namespace>' . "\n" .
'<option value=0>(Main)</option>' . "\n" .
);
}
- function testCanFilterOutNamespaces() {
+ public function testCanFilterOutNamespaces() {
$this->assertEquals(
'<select id=namespace name=namespace>' . "\n" .
'<option value=2>User</option>' . "\n" .
);
}
- function testCanDisableANamespaces() {
+ public function testCanDisableANamespaces() {
$this->assertEquals(
'<select id=namespace name=namespace>' . "\n" .
'<option disabled value=0>(Main)</option>' . "\n" .
/**
* @dataProvider provideHtml5InputTypes
*/
- function testHtmlElementAcceptsNewHtml5TypesInHtml5Mode( $HTML5InputType ) {
+ public function testHtmlElementAcceptsNewHtml5TypesInHtml5Mode( $HTML5InputType ) {
$this->assertEquals(
'<input type=' . $HTML5InputType . '>',
Html::element( 'input', array( 'type' => $HTML5InputType ) ),
* @covers Html::dropDefaults
* @dataProvider provideElementsWithAttributesHavingDefaultValues
*/
- function testDropDefaults( $expected, $element, $attribs, $message = '' ) {
+ public function testDropDefaults( $expected, $element, $attribs, $message = '' ) {
$this->assertEquals( $expected, Html::element( $element, $attribs ), $message );
}
* @dataProvider provideURI
* @covers Http::isValidURI
*/
- function testIsValidUri( $expect, $URI, $message = '' ) {
+ public function testIsValidUri( $expect, $URI, $message = '' ) {
$this->assertEquals(
$expect,
(bool)Http::isValidURI( $URI ),
* representing the network mask and the bit mask.
* @covers IP::parseCIDR
*/
- function testCIDRParsing() {
+ public function testCIDRParsing() {
$this->assertFalseCIDR( '192.0.2.0', "missing mask" );
$this->assertFalseCIDR( '192.0.2.0/', "missing bitmask" );
* Test for IP::splitHostAndPort().
* @dataProvider provideSplitHostAndPort
*/
- function testSplitHostAndPort( $expected, $input, $description ) {
+ public function testSplitHostAndPort( $expected, $input, $description ) {
$this->assertEquals( $expected, IP::splitHostAndPort( $input ), $description );
}
* Test for IP::combineHostAndPort()
* @dataProvider provideCombineHostAndPort
*/
- function testCombineHostAndPort( $expected, $input, $description ) {
+ public function testCombineHostAndPort( $expected, $input, $description ) {
list( $host, $port, $defaultPort ) = $input;
$this->assertEquals(
$expected,
* Test for IP::sanitizeRange()
* @dataProvider provideIPCIDRs
*/
- function testSanitizeRange( $input, $expected, $description ) {
+ public function testSanitizeRange( $input, $expected, $description ) {
$this->assertEquals( $expected, IP::sanitizeRange( $input ), $description );
}
* Test for IP::prettifyIP()
* @dataProvider provideIPsToPrettify
*/
- function testPrettifyIP( $ip, $prettified ) {
+ public function testPrettifyIP( $ip, $prettified ) {
$this->assertEquals( $prettified, IP::prettifyIP( $ip ), "Prettify of $ip" );
}
parent::tearDown();
}
- function testGetPreferredVariantDefaults() {
+ public function testGetPreferredVariantDefaults() {
$this->assertEquals( 'tg', $this->lc->getPreferredVariant() );
}
- function testGetPreferredVariantHeaders() {
+ public function testGetPreferredVariantHeaders() {
global $wgRequest;
$wgRequest->setHeader( 'Accept-Language', 'tg-latn' );
$this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
}
- function testGetPreferredVariantHeaderWeight() {
+ public function testGetPreferredVariantHeaderWeight() {
global $wgRequest;
$wgRequest->setHeader( 'Accept-Language', 'tg;q=1' );
$this->assertEquals( 'tg', $this->lc->getPreferredVariant() );
}
- function testGetPreferredVariantHeaderWeight2() {
+ public function testGetPreferredVariantHeaderWeight2() {
global $wgRequest;
$wgRequest->setHeader( 'Accept-Language', 'tg-latn;q=1' );
$this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
}
- function testGetPreferredVariantHeaderMulti() {
+ public function testGetPreferredVariantHeaderMulti() {
global $wgRequest;
$wgRequest->setHeader( 'Accept-Language', 'en, tg-latn;q=1' );
$this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
}
- function testGetPreferredVariantUserOption() {
+ public function testGetPreferredVariantUserOption() {
global $wgUser;
$wgUser = new User;
$this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
}
- function testGetPreferredVariantUserOptionForForeignLanguage() {
+ public function testGetPreferredVariantUserOptionForForeignLanguage() {
global $wgContLang, $wgUser;
$wgContLang = Language::factory( 'en' );
$this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
}
- function testGetPreferredVariantHeaderUserVsUrl() {
+ public function testGetPreferredVariantHeaderUserVsUrl() {
global $wgContLang, $wgRequest, $wgUser;
$wgContLang = Language::factory( 'tg-latn' );
}
- function testGetPreferredVariantDefaultLanguageVariant() {
+ public function testGetPreferredVariantDefaultLanguageVariant() {
global $wgDefaultLanguageVariant;
$wgDefaultLanguageVariant = 'tg-latn';
$this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
}
- function testGetPreferredVariantDefaultLanguageVsUrlVariant() {
+ public function testGetPreferredVariantDefaultLanguageVsUrlVariant() {
global $wgDefaultLanguageVariant, $wgRequest, $wgContLang;
$wgContLang = Language::factory( 'tg-latn' );
class LicensesTest extends MediaWikiTestCase {
- function testLicenses() {
+ public function testLicenses() {
$str = "
* Free licenses:
** GFDL|Debian disagrees
* @dataProvider provideCasesForUserLink
* @covers Linker::userLink
*/
- function testUserLink( $expected, $userId, $userName, $altUserName = false, $msg = '' ) {
+ public function testUserLink( $expected, $userId, $userName, $altUserName = false, $msg = '' ) {
$this->setMwGlobals( array(
'wgArticlePath' => '/wiki/$1',
'wgWellFormedXml' => true,
$this->file_lc = $this->repo_lc->newFile( 'test!' );
}
- function testGetHashPath() {
+ public function testGetHashPath() {
$this->assertEquals( '', $this->file_hl0->getHashPath() );
$this->assertEquals( 'a/a2/', $this->file_hl2->getHashPath() );
$this->assertEquals( 'c/c4/', $this->file_lc->getHashPath() );
}
- function testGetRel() {
+ public function testGetRel() {
$this->assertEquals( 'Test!', $this->file_hl0->getRel() );
$this->assertEquals( 'a/a2/Test!', $this->file_hl2->getRel() );
$this->assertEquals( 'c/c4/test!', $this->file_lc->getRel() );
}
- function testGetUrlRel() {
+ public function testGetUrlRel() {
$this->assertEquals( 'Test%21', $this->file_hl0->getUrlRel() );
$this->assertEquals( 'a/a2/Test%21', $this->file_hl2->getUrlRel() );
$this->assertEquals( 'c/c4/test%21', $this->file_lc->getUrlRel() );
}
- function testGetArchivePath() {
+ public function testGetArchivePath() {
$this->assertEquals( 'mwstore://local-backend/test-public/archive', $this->file_hl0->getArchivePath() );
$this->assertEquals( 'mwstore://local-backend/test-public/archive/a/a2', $this->file_hl2->getArchivePath() );
$this->assertEquals( 'mwstore://local-backend/test-public/archive/!', $this->file_hl0->getArchivePath( '!' ) );
$this->assertEquals( 'mwstore://local-backend/test-public/archive/a/a2/!', $this->file_hl2->getArchivePath( '!' ) );
}
- function testGetThumbPath() {
+ public function testGetThumbPath() {
$this->assertEquals( 'mwstore://local-backend/test-thumb/Test!', $this->file_hl0->getThumbPath() );
$this->assertEquals( 'mwstore://local-backend/test-thumb/a/a2/Test!', $this->file_hl2->getThumbPath() );
$this->assertEquals( 'mwstore://local-backend/test-thumb/Test!/x', $this->file_hl0->getThumbPath( 'x' ) );
$this->assertEquals( 'mwstore://local-backend/test-thumb/a/a2/Test!/x', $this->file_hl2->getThumbPath( 'x' ) );
}
- function testGetArchiveUrl() {
+ public function testGetArchiveUrl() {
$this->assertEquals( '/testurl/archive', $this->file_hl0->getArchiveUrl() );
$this->assertEquals( '/testurl/archive/a/a2', $this->file_hl2->getArchiveUrl() );
$this->assertEquals( '/testurl/archive/%21', $this->file_hl0->getArchiveUrl( '!' ) );
$this->assertEquals( '/testurl/archive/a/a2/%21', $this->file_hl2->getArchiveUrl( '!' ) );
}
- function testGetThumbUrl() {
+ public function testGetThumbUrl() {
$this->assertEquals( '/testurl/thumb/Test%21', $this->file_hl0->getThumbUrl() );
$this->assertEquals( '/testurl/thumb/a/a2/Test%21', $this->file_hl2->getThumbUrl() );
$this->assertEquals( '/testurl/thumb/Test%21/x', $this->file_hl0->getThumbUrl( 'x' ) );
$this->assertEquals( '/testurl/thumb/a/a2/Test%21/x', $this->file_hl2->getThumbUrl( 'x' ) );
}
- function testGetArchiveVirtualUrl() {
+ public function testGetArchiveVirtualUrl() {
$this->assertEquals( 'mwrepo://test/public/archive', $this->file_hl0->getArchiveVirtualUrl() );
$this->assertEquals( 'mwrepo://test/public/archive/a/a2', $this->file_hl2->getArchiveVirtualUrl() );
$this->assertEquals( 'mwrepo://test/public/archive/%21', $this->file_hl0->getArchiveVirtualUrl( '!' ) );
$this->assertEquals( 'mwrepo://test/public/archive/a/a2/%21', $this->file_hl2->getArchiveVirtualUrl( '!' ) );
}
- function testGetThumbVirtualUrl() {
+ public function testGetThumbVirtualUrl() {
$this->assertEquals( 'mwrepo://test/thumb/Test%21', $this->file_hl0->getThumbVirtualUrl() );
$this->assertEquals( 'mwrepo://test/thumb/a/a2/Test%21', $this->file_hl2->getThumbVirtualUrl() );
$this->assertEquals( 'mwrepo://test/thumb/Test%21/%21', $this->file_hl0->getThumbVirtualUrl( '!' ) );
$this->assertEquals( 'mwrepo://test/thumb/a/a2/Test%21/%21', $this->file_hl2->getThumbVirtualUrl( '!' ) );
}
- function testGetUrl() {
+ public function testGetUrl() {
$this->assertEquals( '/testurl/Test%21', $this->file_hl0->getUrl() );
$this->assertEquals( '/testurl/a/a2/Test%21', $this->file_hl2->getUrl() );
}
- function testWfLocalFile() {
+ public function testWfLocalFile() {
$file = wfLocalFile( "File:Some_file_that_probably_doesn't exist.png" );
$this->assertThat( $file, $this->isInstanceOf( 'LocalFile' ), 'wfLocalFile() returns LocalFile for valid Titles' );
}
<?php
class MWFunctionTest extends MediaWikiTestCase {
- function testNewObjFunction() {
+ public function testNewObjFunction() {
$arg1 = 'Foo';
$arg2 = 'Bar';
$arg3 = array( 'Baz' );
) );
}
- function testExists() {
+ public function testExists() {
$this->assertTrue( wfMessage( 'mainpage' )->exists() );
$this->assertTrue( wfMessage( 'mainpage' )->params( array() )->exists() );
$this->assertTrue( wfMessage( 'mainpage' )->rawParams( 'foo', 123 )->exists() );
$this->assertFalse( wfMessage( 'i-dont-exist-evar' )->rawParams( 'foo', 123 )->exists() );
}
- function testKey() {
+ public function testKey() {
$this->assertInstanceOf( 'Message', wfMessage( 'mainpage' ) );
$this->assertInstanceOf( 'Message', wfMessage( 'i-dont-exist-evar' ) );
$this->assertEquals( 'Main Page', wfMessage( 'mainpage' )->text() );
$this->assertEquals( '<i-dont-exist-evar>', wfMessage( 'i-dont-exist-evar' )->escaped() );
}
- function testInLanguage() {
+ public function testInLanguage() {
$this->assertEquals( 'Main Page', wfMessage( 'mainpage' )->inLanguage( 'en' )->text() );
$this->assertEquals( 'Заглавная страница', wfMessage( 'mainpage' )->inLanguage( 'ru' )->text() );
$this->assertEquals( 'Main Page', wfMessage( 'mainpage' )->inLanguage( Language::factory( 'en' ) )->text() );
$this->assertEquals( 'Заглавная страница', wfMessage( 'mainpage' )->inLanguage( Language::factory( 'ru' ) )->text() );
}
- function testMessageParams() {
+ public function testMessageParams() {
$this->assertEquals( 'Return to $1.', wfMessage( 'returnto' )->text() );
$this->assertEquals( 'Return to $1.', wfMessage( 'returnto', array() )->text() );
$this->assertEquals( 'You have foo (bar).', wfMessage( 'youhavenewmessages', 'foo', 'bar' )->text() );
$this->assertEquals( 'You have foo (bar).', wfMessage( 'youhavenewmessages', array( 'foo', 'bar' ) )->text() );
}
- function testMessageParamSubstitution() {
+ public function testMessageParamSubstitution() {
$this->assertEquals( '(Заглавная страница)', wfMessage( 'parentheses', 'Заглавная страница' )->plain() );
$this->assertEquals( '(Заглавная страница $1)', wfMessage( 'parentheses', 'Заглавная страница $1' )->plain() );
$this->assertEquals( '(Заглавная страница)', wfMessage( 'parentheses' )->rawParams( 'Заглавная страница' )->plain() );
$this->assertEquals( '(Заглавная страница $1)', wfMessage( 'parentheses' )->rawParams( 'Заглавная страница $1' )->plain() );
}
- function testDeliciouslyManyParams() {
+ public function testDeliciouslyManyParams() {
$msg = new RawMessage( '$1$2$3$4$5$6$7$8$9$10$11$12' );
// One less than above has placeholders
$params = array( 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k' );
* FIXME: This should not need database, but Language#formatExpiry does (bug 55912)
* @group Database
*/
- function testMessageParamTypes() {
+ public function testMessageParamTypes() {
$lang = Language::factory( 'en' );
$msg = new RawMessage( '$1' );
);
}
- function testInContentLanguageDisabled() {
+ public function testInContentLanguageDisabled() {
$this->setMwGlobals( 'wgLang', Language::factory( 'fr' ) );
$this->assertEquals( 'Main Page', wfMessage( 'mainpage' )->inContentLanguage()->plain(), 'ForceUIMsg disabled' );
}
- function testInContentLanguageEnabled() {
+ public function testInContentLanguageEnabled() {
$this->setMwGlobals( array(
'wgLang' => Language::factory( 'fr' ),
'wgForceUIMsgAsContentMsg' => array( 'mainpage' ),
/**
* @expectedException MWException
*/
- function testInLanguageThrows() {
+ public function testInLanguageThrows() {
wfMessage( 'foo' )->inLanguage( 123 );
}
}
* "Agile Documentation" at
* http://www.phpunit.de/manual/3.4/en/other-uses-for-tests.html
*/
- function testTitleObjectStringConversion() {
+ public function testTitleObjectStringConversion() {
$title = Title::newFromText( "text" );
$this->assertInstanceOf( 'Title', $title, "Title creation" );
$this->assertEquals( "Text", $title, "Automatic string conversion" );
* @expectedException MWException object
* See http://www.phpunit.de/manual/3.4/en/appendixes.annotations.html#appendixes.annotations.expectedException
*/
- function testTitleObjectFromObject() {
+ public function testTitleObjectFromObject() {
$title = Title::newFromText( Title::newFromText( "test" ) );
$this->assertEquals( "Test", $title->isLocal() );
}
* @covers StringUtils::isUtf8
* @dataProvider provideStringsForIsUtf8Check
*/
- function testIsUtf8WithMbstring( $expected, $string ) {
+ public function testIsUtf8WithMbstring( $expected, $string ) {
if ( !function_exists( 'mb_check_encoding' ) ) {
$this->markTestSkipped( 'Test requires the mbstring PHP extension' );
}
* @covers StringUtils::isUtf8
* @dataProvider provideStringsForIsUtf8Check
*/
- function testIsUtf8WithPhpFallbackImplementation( $expected, $string ) {
+ public function testIsUtf8WithPhpFallbackImplementation( $expected, $string ) {
$this->assertEquals( $expected,
StringUtils::isUtf8( $string, /** disable mbstring: */true ),
'Testing string "' . $this->escaped( $string ) . '" with pure PHP implementation'
/**
* @covers Title::getParentCategories
*/
- function testTemplateCategories() {
+ public function testTemplateCategories() {
$title = Title::newFromText( "Categorized from template" );
$page = WikiPage::factory( $title );
$user = new User();
* @dataProvider provideDetectServer
* @covers WebRequest::detectServer
*/
- function testDetectServer( $expected, $input, $description ) {
+ public function testDetectServer( $expected, $input, $description ) {
$_SERVER = $input;
$result = WebRequest::detectServer();
$this->assertEquals( $expected, $result, $description );
* @dataProvider provideGetIP
* @covers WebRequest::getIP
*/
- function testGetIP( $expected, $input, $squid, $xffList, $private, $description ) {
+ public function testGetIP( $expected, $input, $squid, $xffList, $private, $description ) {
$_SERVER = $input;
$this->setMwGlobals( array(
'wgSquidServersNoPurge' => $squid,
* @expectedException MWException
* @covers WebRequest::getIP
*/
- function testGetIpLackOfRemoteAddrThrowAnException() {
+ public function testGetIpLackOfRemoteAddrThrowAnException() {
$request = new WebRequest();
# Next call throw an exception about lacking an IP
$request->getIP();
* @dataProvider provideLanguageData
* @covers WebRequest::getAcceptLang
*/
- function testAcceptLang( $acceptLanguageHeader, $expectedLanguages, $description ) {
+ public function testAcceptLang( $acceptLanguageHeader, $expectedLanguages, $description ) {
$_SERVER = array( 'HTTP_ACCEPT_LANGUAGE' => $acceptLanguageHeader );
$request = new WebRequest();
$this->assertSame( $request->getAcceptLang(), $expectedLanguages, $description );
/**
* @covers Xml::element
*/
- function testElementOpen() {
+ public function testElementOpen() {
$this->assertEquals(
'<element>',
Xml::element( 'element', null, null ),
/**
* @covers Xml::element
*/
- function testElementEmpty() {
+ public function testElementEmpty() {
$this->assertEquals(
'<element />',
Xml::element( 'element', null, '' ),
/**
* @covers Xml::input
*/
- function testElementInputCanHaveAValueOfZero() {
+ public function testElementInputCanHaveAValueOfZero() {
$this->assertEquals(
'<input name="name" value="0" />',
Xml::input( 'name', false, 0 ),
/**
* @covers Xml::element
*/
- function testElementEscaping() {
+ public function testElementEscaping() {
$this->assertEquals(
'<element>hello <there> you & you</element>',
Xml::element( 'element', null, 'hello <there> you & you' ),
/**
* @covers Xml::element
*/
- function testElementAttributes() {
+ public function testElementAttributes() {
$this->assertEquals(
'<element key="value" <>="<>">',
Xml::element( 'element', array( 'key' => 'value', '<>' => '<>' ), null ),
/**
* @covers Xml::openElement
*/
- function testOpenElement() {
+ public function testOpenElement() {
$this->assertEquals(
'<element k="v">',
Xml::openElement( 'element', array( 'k' => 'v' ) ),
/**
* @covers Xml::closeElement
*/
- function testCloseElement() {
+ public function testCloseElement() {
$this->assertEquals( '</element>', Xml::closeElement( 'element' ), 'closeElement() shortcut' );
}
/**
* @covers Xml::textarea
*/
- function testTextareaNoContent() {
+ public function testTextareaNoContent() {
$this->assertEquals(
'<textarea name="name" id="name" cols="40" rows="5"></textarea>',
Xml::textarea( 'name', '' ),
/**
* @covers Xml::textarea
*/
- function testTextareaAttribs() {
+ public function testTextareaAttribs() {
$this->assertEquals(
'<textarea name="name" id="name" cols="20" rows="10"><txt></textarea>',
Xml::textarea( 'name', '<txt>', 20, 10 ),
/**
* @covers Xml::label
*/
- function testLabelCreation() {
+ public function testLabelCreation() {
$this->assertEquals(
'<label for="id">name</label>',
Xml::label( 'name', 'id' ),
/**
* @covers Xml::label
*/
- function testLabelAttributeCanOnlyBeClassOrTitle() {
+ public function testLabelAttributeCanOnlyBeClassOrTitle() {
$this->assertEquals(
'<label for="id">name</label>',
Xml::label( 'name', 'id', array( 'generated' => true ) ),
/**
* @covers Xml::languageSelector
*/
- function testLanguageSelector() {
+ public function testLanguageSelector() {
$select = Xml::languageSelector( 'en', true, null,
array( 'id' => 'testlang' ), wfMessage( 'yourlanguage' ) );
$this->assertEquals(
/**
* @covers Xml::escapeJsString
*/
- function testEscapeJsStringSpecialChars() {
+ public function testEscapeJsStringSpecialChars() {
$this->assertEquals(
'\\\\\r\n',
Xml::escapeJsString( "\\\r\n" ),
/**
* @covers Xml::encodeJsVar
*/
- function testEncodeJsVarBoolean() {
+ public function testEncodeJsVarBoolean() {
$this->assertEquals(
'true',
Xml::encodeJsVar( true ),
/**
* @covers Xml::encodeJsVar
*/
- function testEncodeJsVarNull() {
+ public function testEncodeJsVarNull() {
$this->assertEquals(
'null',
Xml::encodeJsVar( null ),
/**
* @covers Xml::encodeJsVar
*/
- function testEncodeJsVarArray() {
+ public function testEncodeJsVarArray() {
$this->assertEquals(
'["a",1]',
Xml::encodeJsVar( array( 'a', 1 ) ),
/**
* @covers Xml::encodeJsVar
*/
- function testEncodeJsVarObject() {
+ public function testEncodeJsVarObject() {
$this->assertEquals(
'{"a":"a","b":1}',
Xml::encodeJsVar( (object)array( 'a' => 'a', 'b' => 1 ) ),
/**
* @covers Xml::encodeJsVar
*/
- function testEncodeJsVarInt() {
+ public function testEncodeJsVarInt() {
$this->assertEquals(
'123456',
Xml::encodeJsVar( 123456 ),
/**
* @covers Xml::encodeJsVar
*/
- function testEncodeJsVarFloat() {
+ public function testEncodeJsVarFloat() {
$this->assertEquals(
'1.23456',
Xml::encodeJsVar( 1.23456 ),
/**
* @covers Xml::encodeJsVar
*/
- function testEncodeJsVarIntString() {
+ public function testEncodeJsVarIntString() {
$this->assertEquals(
'"123456"',
Xml::encodeJsVar( '123456' ),
/**
* @covers Xml::encodeJsVar
*/
- function testEncodeJsVarFloatString() {
+ public function testEncodeJsVarFloatString() {
$this->assertEquals(
'"1.23456"',
Xml::encodeJsVar( '1.23456' ),
$this->assertTrue( $status->isOK(), $assertMessage );
}
- function testEmpty() {
+ public function testEmpty() {
$this->readZipAssertSuccess( 'empty.zip', 'Empty zip' );
}
- function testMultiDisk0() {
+ public function testMultiDisk0() {
$this->readZipAssertError( 'split.zip', 'zip-unsupported',
'Split zip error' );
}
- function testNoSignature() {
+ public function testNoSignature() {
$this->readZipAssertError( 'nosig.zip', 'zip-wrong-format',
'No signature should give "wrong format" error' );
}
- function testSimple() {
+ public function testSimple() {
$this->readZipAssertSuccess( 'class.zip', 'Simple ZIP' );
$this->assertEquals( $this->entries, array( array(
'name' => 'Class.class',
) ) );
}
- function testBadCentralEntrySignature() {
+ public function testBadCentralEntrySignature() {
$this->readZipAssertError( 'wrong-central-entry-sig.zip', 'zip-bad',
'Bad central entry error' );
}
- function testTrailingBytes() {
+ public function testTrailingBytes() {
$this->readZipAssertError( 'trail.zip', 'zip-bad',
'Trailing bytes error' );
}
- function testWrongCDStart() {
+ public function testWrongCDStart() {
$this->readZipAssertError( 'wrong-cd-start-disk.zip', 'zip-unsupported',
'Wrong CD start disk error' );
}
- function testCentralDirectoryGap() {
+ public function testCentralDirectoryGap() {
$this->readZipAssertError( 'cd-gap.zip', 'zip-bad',
'CD gap error' );
}
- function testCentralDirectoryTruncated() {
+ public function testCentralDirectoryTruncated() {
$this->readZipAssertError( 'cd-truncated.zip', 'zip-bad',
'CD truncated error (should hit unpack() overrun)' );
}
- function testLooksLikeZip64() {
+ public function testLooksLikeZip64() {
$this->readZipAssertError( 'looks-like-zip64.zip', 'zip-unsupported',
'A file which looks like ZIP64 but isn\'t, should give error' );
}
* a bit slow. Raise the default timeout.
* @group medium
*/
- function testValid() {
+ public function testValid() {
global $wgServer;
if ( !isset( $wgServer ) ) {
* Make sure requests with no names are invalid.
* @expectedException UsageException
*/
- function testNoName() {
+ public function testNoName() {
$this->doApiRequest( array(
'action' => 'createaccount',
'token' => LoginForm::getCreateaccountToken(),
* Make sure requests with no password are invalid.
* @expectedException UsageException
*/
- function testNoPassword() {
+ public function testNoPassword() {
$this->doApiRequest( array(
'action' => 'createaccount',
'name' => 'testName',
* Make sure requests with existing users are invalid.
* @expectedException UsageException
*/
- function testExistingUser() {
+ public function testExistingUser() {
$this->doApiRequest( array(
'action' => 'createaccount',
'name' => 'Apitestsysop',
* Make sure requests with invalid emails are invalid.
* @expectedException UsageException
*/
- function testInvalidEmail() {
+ public function testInvalidEmail() {
$this->doApiRequest( array(
'action' => 'createaccount',
'name' => 'Test User',
* Which made the Block/Unblock API to actually verify the token
* previously always considered valid (bug 34212).
*/
- function testMakeNormalBlock() {
+ public function testMakeNormalBlock() {
$tokens = $this->getTokens();
$user = User::newFromName( 'UTApiBlockee' );
* @dataProvider provideBlockUnblockAction
* @expectedException UsageException
*/
- function testBlockingActionWithNoToken( $action ) {
+ public function testBlockingActionWithNoToken( $action ) {
$this->doApiRequest(
array(
'action' => $action,
parent::tearDown();
}
- function testEdit() {
+ public function testEdit() {
$name = 'Help:ApiEditPageTest_testEdit'; // assume Help namespace to default to wikitext
// -- test new page --------------------------------------------
);
}
- function testNonTextEdit() {
+ public function testNonTextEdit() {
$name = 'Dummy:ApiEditPageTest_testNonTextEdit';
$data = serialize( 'some bla bla text' );
/**
* @dataProvider provideEditAppend
*/
- function testEditAppend( $text, $op, $append, $expected ) {
+ public function testEditAppend( $text, $op, $append, $expected ) {
static $count = 0;
$count++;
/**
* Test editing of sections
*/
- function testEditSection() {
+ public function testEditSection() {
$name = 'Help:ApiEditPageTest_testEditSection';
$page = WikiPage::factory( Title::newFromText( $name ) );
$text = "==section 1==\ncontent 1\n==section 2==\ncontent2";
* page that doesn't exist (bug 52830) and one that
* does exist
*/
- function testEditNewSection() {
+ public function testEditNewSection() {
$name = 'Help:ApiEditPageTest_testEditNewSection';
// Test on a page that does not already exist
$this->assertEquals( $text, "== header ==\n\ntest\n\n== header ==\n\ntest" );
}
- function testEditConflict() {
+ public function testEditConflict() {
static $count = 0;
$count++;
}
}
- function testEditConflict_redirect() {
+ public function testEditConflict_redirect() {
static $count = 0;
$count++;
}
}
- function testEditConflict_bug41990() {
+ public function testEditConflict_bug41990() {
static $count = 0;
$count++;
$this->doLogin();
}
- function testParseNonexistentPage() {
+ public function testParseNonexistentPage() {
$somePage = mt_rand();
try {
/**
* @group Broken
*/
- function testPurgeMainPage() {
+ public function testPurgeMainPage() {
if ( !Title::newFromText( 'UTPage' )->exists() ) {
$this->markTestIncomplete( "The article [[UTPage]] does not exist" );
}
*/
class ApiTest extends ApiTestCase {
- function testRequireOnlyOneParameterDefault() {
+ public function testRequireOnlyOneParameterDefault() {
$mock = new MockApi();
$this->assertEquals(
/**
* @expectedException UsageException
*/
- function testRequireOnlyOneParameterZero() {
+ public function testRequireOnlyOneParameterZero() {
$mock = new MockApi();
$this->assertEquals(
/**
* @expectedException UsageException
*/
- function testRequireOnlyOneParameterTrue() {
+ public function testRequireOnlyOneParameterTrue() {
$mock = new MockApi();
$this->assertEquals(
*
* @expectedException UsageException
*/
- function testApi() {
+ public function testApi() {
$api = new ApiMain(
new FauxRequest( array( 'action' => 'help', 'format' => 'xml' ) )
);
/**
* Test result of attempted login with an empty username
*/
- function testApiLoginNoName() {
+ public function testApiLoginNoName() {
$data = $this->doApiRequest( array( 'action' => 'login',
'lgname' => '', 'lgpassword' => self::$users['sysop']->password,
) );
$this->assertEquals( 'NoName', $data[0]['login']['result'] );
}
- function testApiLoginBadPass() {
+ public function testApiLoginBadPass() {
global $wgServer;
$user = self::$users['sysop'];
$this->assertEquals( "WrongPass", $a );
}
- function testApiLoginGoodPass() {
+ public function testApiLoginGoodPass() {
global $wgServer;
if ( !isset( $wgServer ) ) {
/**
* @group Broken
*/
- function testApiGotCookie() {
+ public function testApiGotCookie() {
$this->markTestIncomplete( "The server can't do external HTTP requests, and the internal one won't give cookies" );
global $wgServer, $wgScriptPath;
return $cj;
}
- function testRunLogin() {
+ public function testRunLogin() {
$sysopUser = self::$users['sysop'];
$data = $this->doApiRequest( array(
'action' => 'login',
return $data;
}
- function testGettingToken() {
+ public function testGettingToken() {
foreach ( self::$users as $user ) {
$this->runTokenTest( $user );
}
* Testing login
* XXX this is a funny way of getting session context
*/
- function testLogin() {
+ public function testLogin() {
$user = self::$users['uploader'];
$params = array(
/**
*/
- function testWatchEdit() {
+ public function testWatchEdit() {
$tokens = $this->getTokens();
$data = $this->doApiRequest( array(
/**
* @depends testWatchEdit
*/
- function testWatchClear() {
+ public function testWatchClear() {
$tokens = $this->getTokens();
$data = $this->doApiRequest( array(
/**
*/
- function testWatchProtect() {
+ public function testWatchProtect() {
$tokens = $this->getTokens();
$data = $this->doApiRequest( array(
/**
*/
- function testGetRollbackToken() {
+ public function testGetRollbackToken() {
$this->getTokens();
if ( !Title::newFromText( 'Help:UTPage' )->exists() ) {
*
* @depends testGetRollbackToken
*/
- function testWatchRollback( $data ) {
+ public function testWatchRollback( $data ) {
$keys = array_keys( $data[0]['query']['pages'] );
$key = array_pop( $keys );
$pageinfo = $data[0]['query']['pages'][$key];
*/
class ApiFormatPhpTest extends ApiFormatTestBase {
- function testValidPhpSyntax() {
+ public function testValidPhpSyntax() {
$data = $this->apiRequest( 'php', array( 'action' => 'query', 'meta' => 'siteinfo' ) );
/**
* @group medium
*/
- function testContentComesWithContentModelAndFormat() {
+ public function testContentComesWithContentModelAndFormat() {
$pageName = 'Help:' . __METHOD__;
$title = Title::newFromText( $pageName );
$page = WikiPage::factory( $title );
$this->doLogin();
}
- function testTitlesGetNormalized() {
+ public function testTitlesGetNormalized() {
global $wgMetaNamespace;
);
}
- function testTitlesAreRejectedIfInvalid() {
+ public function testTitlesAreRejectedIfInvalid() {
$title = false;
while ( !$title || Title::newFromText( $title )->exists() ) {
$title = md5( mt_rand( 0, 10000 ) + rand( 0, 999000 ) );
* @dataProvider provideUserGenders
* @covers GenderCache::getGenderOf
*/
- function testUserName( $username, $expectedGender ) {
+ public function testUserName( $username, $expectedGender ) {
$genderCache = GenderCache::singleton();
$gender = $genderCache->getGenderOf( $username );
$this->assertEquals( $gender, $expectedGender, "GenderCache normal" );
* @dataProvider provideUserGenders
* @covers GenderCache::getGenderOf
*/
- function testUserObjects( $username, $expectedGender ) {
+ public function testUserObjects( $username, $expectedGender ) {
$genderCache = GenderCache::singleton();
$user = User::newFromName( $username );
$gender = $genderCache->getGenderOf( $user );
* @dataProvider provideStripSubpages
* @covers GenderCache::getGenderOf
*/
- function testStripSubpages( $pageWithSubpage, $expectedGender ) {
+ public function testStripSubpages( $pageWithSubpage, $expectedGender ) {
$genderCache = GenderCache::singleton();
$gender = $genderCache->getGenderOf( $pageWithSubpage );
$this->assertEquals( $gender, $expectedGender, "GenderCache must strip of subpages" );
*
* @dataProvider provideMessagesForFallback
*/
- function testMessageFallbacks( $message, $lang, $expectedContent ) {
+ public function testMessageFallbacks( $message, $lang, $expectedContent ) {
$result = MessageCache::singleton()->get( $message, true, $lang );
$this->assertEquals( $expectedContent, $result, "Message fallback failed." );
}
*
* @dataProvider provideMessagesForFullKeys
*/
- function testFullKeyBehaviour( $message, $lang, $expectedContent ) {
+ public function testFullKeyBehaviour( $message, $lang, $expectedContent ) {
$result = MessageCache::singleton()->get( $message, true, $lang, true );
$this->assertEquals( $expectedContent, $result, "Full key message fallback failed." );
}
/**
* Highlight diff between assertEquals and assertNotSame
*/
- function testPhpUnitArrayEquality() {
+ public function testPhpUnitArrayEquality() {
$one = array( 'A' => 1, 'B' => 2 );
$two = array( 'B' => 2, 'A' => 1 );
$this->assertEquals( $one, $two ); // ==
* @dataProvider provideInvalidConstructorArg
* @expectedException MWException
*/
- function testConstructorGivenInvalidValue( $maxSize ) {
+ public function testConstructorGivenInvalidValue( $maxSize ) {
new ProcessCacheLRUTestable( $maxSize );
}
);
}
- function testAddAndGetAKey() {
+ public function testAddAndGetAKey() {
$oneCache = new ProcessCacheLRUTestable( 1 );
$this->assertCacheEmpty( $oneCache );
$this->assertEquals( 'value1', $oneCache->get( 'cache-key', 'prop1' ) );
}
- function testDeleteOldKey() {
+ public function testDeleteOldKey() {
$oneCache = new ProcessCacheLRUTestable( 1 );
$this->assertCacheEmpty( $oneCache );
* @param $cacheMaxEntries Maximum entry the created cache will hold
* @param $entryToFill Number of entries to insert in the created cache.
*/
- function testFillingCache( $cacheMaxEntries, $entryToFill, $msg = '' ) {
+ public function testFillingCache( $cacheMaxEntries, $entryToFill, $msg = '' ) {
$cache = new ProcessCacheLRUTestable( $cacheMaxEntries );
$this->fillCache( $cache, $entryToFill );
* Create a cache with only one remaining entry then update
* the first inserted entry. Should bump it to the top.
*/
- function testReplaceExistingKeyShouldBumpEntryToTop() {
+ public function testReplaceExistingKeyShouldBumpEntryToTop() {
$maxEntries = 3;
$cache = new ProcessCacheLRUTestable( $maxEntries );
);
}
- function testRecentlyAccessedKeyStickIn() {
+ public function testRecentlyAccessedKeyStickIn() {
$cache = new ProcessCacheLRUTestable( 2 );
$cache->set( 'first', 'prop1', 'value1' );
$cache->set( 'second', 'prop2', 'value2' );
* Given a cache having 1,2,3 as key, updating 2 should bump 2 to
* the top of the queue with the new value: 1,3,2* (* = updated).
*/
- function testReplaceExistingKeyInAFullCacheShouldBumpToTop() {
+ public function testReplaceExistingKeyInAFullCacheShouldBumpToTop() {
$maxEntries = 3;
$cache = new ProcessCacheLRUTestable( $maxEntries );
);
}
- function testBumpExistingKeyToTop() {
+ public function testBumpExistingKeyToTop() {
$cache = new ProcessCacheLRUTestable( 3 );
$this->fillCache( $cache, 3 );
* @dataProvider provideDiapers
* @covers DatabaseMysqlBase::addIdentifierQuotes
*/
- function testAddIdentifierQuotes( $expected, $in ) {
+ public function testAddIdentifierQuotes( $expected, $in ) {
$db = new FakeDatabaseMysqlBase();
$quoted = $db->addIdentifierQuotes( $in );
$this->assertEquals($expected, $quoted);
* @dataProvider provideSelect
* @covers DatabaseBase::select
*/
- function testSelect( $sql, $sqlText ) {
+ public function testSelect( $sql, $sqlText ) {
$this->database->select(
$sql['tables'],
$sql['fields'],
* @dataProvider provideUpdate
* @covers DatabaseBase::update
*/
- function testUpdate( $sql, $sqlText ) {
+ public function testUpdate( $sql, $sqlText ) {
$this->database->update(
$sql['table'],
$sql['values'],
* @dataProvider provideDelete
* @covers DatabaseBase::delete
*/
- function testDelete( $sql, $sqlText ) {
+ public function testDelete( $sql, $sqlText ) {
$this->database->delete(
$sql['table'],
$sql['conds'],
* @dataProvider provideUpsert
* @covers DatabaseBase::upsert
*/
- function testUpsert( $sql, $sqlText ) {
+ public function testUpsert( $sql, $sqlText ) {
$this->database->upsert(
$sql['table'],
$sql['rows'],
* @dataProvider provideDeleteJoin
* @covers DatabaseBase::deleteJoin
*/
- function testDeleteJoin( $sql, $sqlText ) {
+ public function testDeleteJoin( $sql, $sqlText ) {
$this->database->deleteJoin(
$sql['delTable'],
$sql['joinTable'],
* @dataProvider provideInsert
* @covers DatabaseBase::insert
*/
- function testInsert( $sql, $sqlText ) {
+ public function testInsert( $sql, $sqlText ) {
$this->database->insert(
$sql['table'],
$sql['rows'],
* @dataProvider provideInsertSelect
* @covers DatabaseBase::insertSelect
*/
- function testInsertSelect( $sql, $sqlText ) {
+ public function testInsertSelect( $sql, $sqlText ) {
$this->database->insertSelect(
$sql['destTable'],
$sql['srcTable'],
* @dataProvider provideReplace
* @covers DatabaseBase::replace
*/
- function testReplace( $sql, $sqlText ) {
+ public function testReplace( $sql, $sqlText ) {
$this->database->replace(
$sql['table'],
$sql['uniqueIndexes'],
* @dataProvider provideNativeReplace
* @covers DatabaseBase::nativeReplace
*/
- function testNativeReplace( $sql, $sqlText ) {
+ public function testNativeReplace( $sql, $sqlText ) {
$this->database->nativeReplace(
$sql['table'],
$sql['rows'],
* @dataProvider provideConditional
* @covers DatabaseBase::conditional
*/
- function testConditional( $sql, $sqlText ) {
+ public function testConditional( $sql, $sqlText ) {
$this->assertEquals( trim( $this->database->conditional(
$sql['conds'],
$sql['true'],
* @dataProvider provideBuildConcat
* @covers DatabaseBase::buildConcat
*/
- function testBuildConcat( $stringList, $sqlText ) {
+ public function testBuildConcat( $stringList, $sqlText ) {
$this->assertEquals( trim( $this->database->buildConcat(
$stringList
) ), $sqlText );
* @dataProvider provideBuildLike
* @covers DatabaseBase::buildLike
*/
- function testBuildLike( $array, $sqlText ) {
+ public function testBuildLike( $array, $sqlText ) {
$this->assertEquals( trim( $this->database->buildLike(
$array
) ), $sqlText );
* @dataProvider provideUnionQueries
* @covers DatabaseBase::unionQueries
*/
- function testUnionQueries( $sql, $sqlText ) {
+ public function testUnionQueries( $sql, $sqlText ) {
$this->assertEquals( trim( $this->database->unionQueries(
$sql['sqls'],
$sql['all']
/**
* @covers DatabaseBase::commit
*/
- function testTransactionCommit() {
+ public function testTransactionCommit() {
$this->database->begin( __METHOD__ );
$this->database->commit( __METHOD__ );
$this->assertLastSql( 'BEGIN; COMMIT' );
/**
* @covers DatabaseBase::rollback
*/
- function testTransactionRollback() {
+ public function testTransactionRollback() {
$this->database->begin( __METHOD__ );
$this->database->rollback( __METHOD__ );
$this->assertLastSql( 'BEGIN; ROLLBACK' );
/**
* @covers DatabaseBase::dropTable
*/
- function testDropTable() {
+ public function testDropTable() {
$this->database->setExistingTables( array( 'table' ) );
$this->database->dropTable( 'table', __METHOD__ );
$this->assertLastSql( 'DROP TABLE table' );
/**
* @covers DatabaseBase::dropTable
*/
- function testDropNonExistingTable() {
+ public function testDropNonExistingTable() {
$this->assertFalse(
$this->database->dropTable( 'non_existing', __METHOD__ )
);
return $indexes;
}
- function testCaseInsensitiveLike() {
+ public function testCaseInsensitiveLike() {
// TODO: Test this for all databases
$db = new DatabaseSqliteStandalone( ':memory:' );
$res = $db->query( 'SELECT "a" LIKE "A" AS a' );
/**
* @covers DatabaseBase::dropTable
*/
- function testAddQuotesNull() {
+ public function testAddQuotesNull() {
$check = "NULL";
if ( $this->db->getType() === 'sqlite' || $this->db->getType() === 'oracle' ) {
$check = "''";
$this->assertEquals( $check, $this->db->addQuotes( null ) );
}
- function testAddQuotesInt() {
+ public function testAddQuotesInt() {
# returning just "1234" should be ok too, though...
# maybe
$this->assertEquals(
$this->db->addQuotes( 1234 ) );
}
- function testAddQuotesFloat() {
+ public function testAddQuotesFloat() {
# returning just "1234.5678" would be ok too, though
$this->assertEquals(
"'1234.5678'",
$this->db->addQuotes( 1234.5678 ) );
}
- function testAddQuotesString() {
+ public function testAddQuotesString() {
$this->assertEquals(
"'string'",
$this->db->addQuotes( 'string' ) );
}
- function testAddQuotesStringQuote() {
+ public function testAddQuotesStringQuote() {
$check = "'string''s cause trouble'";
if ( $this->db->getType() === 'mysql' ) {
$check = "'string\'s cause trouble'";
}
}
- function testTableNameLocal() {
+ public function testTableNameLocal() {
$this->assertEquals(
$this->prefixAndQuote( 'tablename' ),
$this->db->tableName( 'tablename' )
);
}
- function testTableNameRawLocal() {
+ public function testTableNameRawLocal() {
$this->assertEquals(
$this->prefixAndQuote( 'tablename', null, null, 'raw' ),
$this->db->tableName( 'tablename', 'raw' )
);
}
- function testTableNameShared() {
+ public function testTableNameShared() {
$this->assertEquals(
$this->prefixAndQuote( 'tablename', 'sharedatabase', 'sh_' ),
$this->getSharedTableName( 'tablename', 'sharedatabase', 'sh_' )
);
}
- function testTableNameRawShared() {
+ public function testTableNameRawShared() {
$this->assertEquals(
$this->prefixAndQuote( 'tablename', 'sharedatabase', 'sh_', 'raw' ),
$this->getSharedTableName( 'tablename', 'sharedatabase', 'sh_', 'raw' )
);
}
- function testTableNameForeign() {
+ public function testTableNameForeign() {
$this->assertEquals(
$this->prefixAndQuote( 'tablename', 'databasename', '' ),
$this->db->tableName( 'databasename.tablename' )
);
}
- function testTableNameRawForeign() {
+ public function testTableNameRawForeign() {
$this->assertEquals(
$this->prefixAndQuote( 'tablename', 'databasename', '', 'raw' ),
$this->db->tableName( 'databasename.tablename', 'raw' )
);
}
- function testFillPreparedEmpty() {
+ public function testFillPreparedEmpty() {
$sql = $this->db->fillPrepared(
'SELECT * FROM interwiki', array() );
$this->assertEquals(
$sql );
}
- function testFillPreparedQuestion() {
+ public function testFillPreparedQuestion() {
$sql = $this->db->fillPrepared(
'SELECT * FROM cur WHERE cur_namespace=? AND cur_title=?',
array( 4, "Snicker's_paradox" ) );
$this->assertEquals( $check, $sql );
}
- function testFillPreparedBang() {
+ public function testFillPreparedBang() {
$sql = $this->db->fillPrepared(
'SELECT user_id FROM ! WHERE user_name=?',
array( '"user"', "Slash's Dot" ) );
$this->assertEquals( $check, $sql );
}
- function testFillPreparedRaw() {
+ public function testFillPreparedRaw() {
$sql = $this->db->fillPrepared(
"SELECT * FROM cur WHERE cur_title='This_\\&_that,_WTF\\?\\!'",
array( '"user"', "Slash's Dot" ) );
$sql );
}
- function testStoredFunctions() {
+ public function testStoredFunctions() {
if ( !in_array( wfGetDB( DB_MASTER )->getType(), array( 'mysql', 'postgres' ) ) ) {
$this->markTestSkipped( 'MySQL or Postgres required' );
}
);
}
- function testUnknownTableCorruptsResults() {
+ public function testUnknownTableCorruptsResults() {
$res = $this->db->select( 'page', '*', array( 'page_id' => 1 ) );
$this->assertFalse( $this->db->tableExists( 'foobarbaz' ) );
$this->assertInternalType( 'int', $res->numRows() );
parent::tearDown();
}
- function testAddLog() {
+ public function testAddLog() {
MWDebug::log( 'logging a string' );
$this->assertEquals(
array( array(
);
}
- function testAddWarning() {
+ public function testAddWarning() {
MWDebug::warning( 'Warning message' );
$this->assertEquals(
array( array(
);
}
- function testAvoidDuplicateDeprecations() {
+ public function testAvoidDuplicateDeprecations() {
MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
);
}
- function testAvoidNonConsecutivesDuplicateDeprecations() {
+ public function testAvoidNonConsecutivesDuplicateDeprecations() {
MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
MWDebug::warning( 'some warning' );
MWDebug::log( 'we could have logged something too' );
* @expectedException MWException
* @covers FileRepo::__construct
*/
- function testFileRepoConstructionOptionCanNotBeNull() {
+ public function testFileRepoConstructionOptionCanNotBeNull() {
new FileRepo();
}
* @expectedException MWException
* @covers FileRepo::__construct
*/
- function testFileRepoConstructionOptionCanNotBeAnEmptyArray() {
+ public function testFileRepoConstructionOptionCanNotBeAnEmptyArray() {
new FileRepo( array() );
}
* @expectedException MWException
* @covers FileRepo::__construct
*/
- function testFileRepoConstructionOptionNeedNameKey() {
+ public function testFileRepoConstructionOptionNeedNameKey() {
new FileRepo( array(
'backend' => 'foobar'
) );
* @expectedException MWException
* @covers FileRepo::__construct
*/
- function testFileRepoConstructionOptionNeedBackendKey() {
+ public function testFileRepoConstructionOptionNeedBackendKey() {
new FileRepo( array(
'name' => 'foobar'
) );
/**
* @covers FileRepo::__construct
*/
- function testFileRepoConstructionWithRequiredOptions() {
+ public function testFileRepoConstructionWithRequiredOptions() {
$f = new FileRepo( array(
'name' => 'FileRepoTestRepository',
'backend' => new FSFileBackend( array(
* @covers InstallDocFormatter::format
* @dataProvider provideDocFormattingTests
*/
- function testFormat( $expected, $unformattedText, $message = '' ) {
+ public function testFormat( $expected, $unformattedText, $message = '' ) {
$this->assertEquals(
$expected,
InstallDocFormatter::format( $unformattedText ),
* @dataProvider provideOracleConnectStrings
* @covers OracleInstaller::checkConnectStringFormat
*/
- function testCheckConnectStringFormat( $expected, $connectString, $msg = '' ) {
+ public function testCheckConnectStringFormat( $expected, $connectString, $msg = '' ) {
$validity = $expected ? 'should be valid' : 'should NOT be valid';
$msg = "'$connectString' ($msg) $validity.";
$this->assertEquals( $expected,
/**
* @dataProvider provider_queueLists
*/
- function testProperties( $queue, $recycles, $desc ) {
+ public function testProperties( $queue, $recycles, $desc ) {
$queue = $this->$queue;
if ( !$queue ) {
$this->markTestSkipped( $desc );
/**
* @dataProvider provider_queueLists
*/
- function testBasicOperations( $queue, $recycles, $desc ) {
+ public function testBasicOperations( $queue, $recycles, $desc ) {
$queue = $this->$queue;
if ( !$queue ) {
$this->markTestSkipped( $desc );
/**
* @dataProvider provider_queueLists
*/
- function testBasicDeduplication( $queue, $recycles, $desc ) {
+ public function testBasicDeduplication( $queue, $recycles, $desc ) {
$queue = $this->$queue;
if ( !$queue ) {
$this->markTestSkipped( $desc );
/**
* @dataProvider provider_queueLists
*/
- function testRootDeduplication( $queue, $recycles, $desc ) {
+ public function testRootDeduplication( $queue, $recycles, $desc ) {
$queue = $this->$queue;
if ( !$queue ) {
$this->markTestSkipped( $desc );
/**
* @dataProvider provider_fifoQueueLists
*/
- function testJobOrder( $queue, $recycles, $desc ) {
+ public function testJobOrder( $queue, $recycles, $desc ) {
$queue = $this->$queue;
if ( !$queue ) {
$this->markTestSkipped( $desc );
/**
* @dataProvider provideMinifyCases
*/
- function testMinify( $code, $expectedOutput ) {
+ public function testMinify( $code, $expectedOutput ) {
$minified = CSSMin::minify( $code );
$this->assertEquals( $expectedOutput, $minified, 'Minified output should be in the form expected.' );
/**
* @dataProvider provideRemapCases
*/
- function testRemap( $message, $params, $expectedOutput ) {
+ public function testRemap( $message, $params, $expectedOutput ) {
$remapped = call_user_func_array( 'CSSMin::remap', $params );
$messageAdd = " Case: $message";
* @group Broken
* @dataProvider provideStringCases
*/
- function testMinifyWithCSSStringValues( $code, $expectedOutput ) {
+ public function testMinifyWithCSSStringValues( $code, $expectedOutput ) {
$this->testMinifyOutput( $code, $expectedOutput );
}
* Tests for IEUrlExtension::findIE6Extension
*/
class IEUrlExtensionTest extends MediaWikiTestCase {
- function testSimple() {
+ public function testSimple() {
$this->assertEquals(
'y',
IEUrlExtension::findIE6Extension( 'x.y' ),
);
}
- function testSimpleNoExt() {
+ public function testSimpleNoExt() {
$this->assertEquals(
'',
IEUrlExtension::findIE6Extension( 'x' ),
);
}
- function testEmpty() {
+ public function testEmpty() {
$this->assertEquals(
'',
IEUrlExtension::findIE6Extension( '' ),
);
}
- function testQuestionMark() {
+ public function testQuestionMark() {
$this->assertEquals(
'',
IEUrlExtension::findIE6Extension( '?' ),
);
}
- function testExtQuestionMark() {
+ public function testExtQuestionMark() {
$this->assertEquals(
'x',
IEUrlExtension::findIE6Extension( '.x?' ),
);
}
- function testQuestionMarkExt() {
+ public function testQuestionMarkExt() {
$this->assertEquals(
'x',
IEUrlExtension::findIE6Extension( '?.x' ),
);
}
- function testInvalidChar() {
+ public function testInvalidChar() {
$this->assertEquals(
'',
IEUrlExtension::findIE6Extension( '.x*' ),
);
}
- function testInvalidCharThenExtension() {
+ public function testInvalidCharThenExtension() {
$this->assertEquals(
'x',
IEUrlExtension::findIE6Extension( '*.x' ),
);
}
- function testMultipleQuestionMarks() {
+ public function testMultipleQuestionMarks() {
$this->assertEquals(
'c',
IEUrlExtension::findIE6Extension( 'a?b?.c?.d?e?f' ),
);
}
- function testExeException() {
+ public function testExeException() {
$this->assertEquals(
'd',
IEUrlExtension::findIE6Extension( 'a?b?.exe?.d?.e' ),
);
}
- function testExeException2() {
+ public function testExeException2() {
$this->assertEquals(
'exe',
IEUrlExtension::findIE6Extension( 'a?b?.exe' ),
);
}
- function testHash() {
+ public function testHash() {
$this->assertEquals(
'',
IEUrlExtension::findIE6Extension( 'a#b.c' ),
);
}
- function testHash2() {
+ public function testHash2() {
$this->assertEquals(
'',
IEUrlExtension::findIE6Extension( 'a?#b.c' ),
);
}
- function testDotAtEnd() {
+ public function testDotAtEnd() {
$this->assertEquals(
'',
IEUrlExtension::findIE6Extension( '.' ),
);
}
- function testTwoDots() {
+ public function testTwoDots() {
$this->assertEquals(
'z',
IEUrlExtension::findIE6Extension( 'x.y.z' ),
/**
* @dataProvider provideCases
*/
- function testJavaScriptMinifierOutput( $code, $expectedOutput ) {
+ public function testJavaScriptMinifierOutput( $code, $expectedOutput ) {
$minified = JavaScriptMinifier::minify( $code );
// JSMin+'s parser will throw an exception if output is not valid JS.
/**
* @dataProvider provideBug32548
*/
- function testBug32548Exponent( $num ) {
+ public function testBug32548Exponent( $num ) {
// Long line breaking was being incorrectly done between the base and
// exponent part of a number, causing a syntax error. The line should
// instead break at the start of the number.
*/
class CleanUpTest extends MediaWikiTestCase {
/** @todo document */
- function testAscii() {
+ public function testAscii() {
$text = 'This is plain ASCII text.';
$this->assertEquals( $text, UtfNormal::cleanUp( $text ) );
}
/** @todo document */
- function testNull() {
+ public function testNull() {
$text = "a \x00 null";
$expect = "a \xef\xbf\xbd null";
$this->assertEquals(
}
/** @todo document */
- function testLatin() {
+ public function testLatin() {
$text = "L'\xc3\xa9cole";
$this->assertEquals( $text, UtfNormal::cleanUp( $text ) );
}
/** @todo document */
- function testLatinNormal() {
+ public function testLatinNormal() {
$text = "L'e\xcc\x81cole";
$expect = "L'\xc3\xa9cole";
$this->assertEquals( $expect, UtfNormal::cleanUp( $text ) );
}
/** @todo document */
- function testAllBytes() {
+ public function testAllBytes() {
$this->doTestBytes( '', '' );
$this->doTestBytes( 'x', '' );
$this->doTestBytes( '', 'x' );
}
/** @todo document */
- function testDoubleBytes() {
+ public function testDoubleBytes() {
$this->doTestDoubleBytes( '', '' );
$this->doTestDoubleBytes( 'x', '' );
$this->doTestDoubleBytes( '', 'x' );
}
/** @todo document */
- function testTripleBytes() {
+ public function testTripleBytes() {
$this->doTestTripleBytes( '', '' );
$this->doTestTripleBytes( 'x', '' );
$this->doTestTripleBytes( '', 'x' );
}
/** @todo document */
- function testChunkRegression() {
+ public function testChunkRegression() {
# Check for regression against a chunking bug
$text = "\x46\x55\xb8" .
"\xdc\x96" .
}
/** @todo document */
- function testInterposeRegression() {
+ public function testInterposeRegression() {
$text = "\x4e\x30" .
"\xb1" . # bad tail
"\x3a" .
}
/** @todo document */
- function testOverlongRegression() {
+ public function testOverlongRegression() {
$text = "\x67" .
"\x1a" . # forbidden ascii
"\xea" . # bad head
}
/** @todo document */
- function testSurrogateRegression() {
+ public function testSurrogateRegression() {
$text = "\xed\xb4\x96" . # surrogate 0xDD16
"\x83" . # bad tail
"\xb4" . # bad tail
}
/** @todo document */
- function testBomRegression() {
+ public function testBomRegression() {
$text = "\xef\xbf\xbe" . # U+FFFE, illegal char
"\xb2" . # bad tail
"\xef" . # bad head
}
/** @todo document */
- function testForbiddenRegression() {
+ public function testForbiddenRegression() {
$text = "\xef\xbf\xbf"; # U+FFFF, illegal char
$expect = "\xef\xbf\xbd";
$this->assertEquals(
}
/** @todo document */
- function testHangulRegression() {
+ public function testHangulRegression() {
$text = "\xed\x9c\xaf" . # Hangul char
"\xe1\x87\x81"; # followed by another final jamo
$expect = $text; # Should *not* change.
*
* @group ParserFuzz
*/
- function testFuzzTests() {
+ public function testFuzzTests() {
global $wgParserTestFiles;
$files = $wgParserTestFiles;
* @dataProvider provideHeadings
* @covers Preprocessor_DOM::preprocessToXml
*/
- function testHeadings( $wikiText, $expectedXml ) {
+ public function testHeadings( $wikiText, $expectedXml ) {
$this->assertEquals( $this->normalizeXml( $expectedXml ), $this->preprocessToXml( $wikiText ) );
}
}
/**
* @dataProvider provideValidNames
*/
- function testTagHooks( $tag ) {
+ public function testTagHooks( $tag ) {
global $wgParserConf, $wgContLang;
$parser = new Parser( $wgParserConf );
* @dataProvider provideBadNames
* @expectedException MWException
*/
- function testBadTagHooks( $tag ) {
+ public function testBadTagHooks( $tag ) {
global $wgParserConf, $wgContLang;
$parser = new Parser( $wgParserConf );
/**
* @dataProvider provideValidNames
*/
- function testFunctionTagHooks( $tag ) {
+ public function testFunctionTagHooks( $tag ) {
global $wgParserConf, $wgContLang;
$parser = new Parser( $wgParserConf );
* @dataProvider provideBadNames
* @expectedException MWException
*/
- function testBadFunctionTagHooks( $tag ) {
+ public function testBadFunctionTagHooks( $tag ) {
global $wgParserConf, $wgContLang;
$parser = new Parser( $wgParserConf );
return true;
}
- function testFullWidth() {
+ public function testFullWidth() {
$this->assertEquals(
array( 'FullOneUp', 'FullTwoLow', 'HalfOneUp', 'HalfTwoLow' ),
$this->fetchIds( $this->search->searchText( 'AZ' ) ),
"Search for normalized from Full-width Lower" );
}
- function testTextSearch() {
+ public function testTextSearch() {
$this->assertEquals(
array( 'Smithee' ),
$this->fetchIds( $this->search->searchText( 'smithee' ) ),
"Plain search failed" );
}
- function testTextPowerSearch() {
+ public function testTextPowerSearch() {
$this->search->setNamespaces( array( 0, 1, 4 ) );
$this->assertEquals(
array(
"Power search failed" );
}
- function testTitleSearch() {
+ public function testTitleSearch() {
$this->assertEquals(
array(
'Alan Smithee',
"Title search failed" );
}
- function testTextTitlePowerSearch() {
+ public function testTextTitlePowerSearch() {
$this->search->setNamespaces( array( 0, 1, 4 ) );
$this->assertEquals(
array(
return trim( SearchUpdate::updateText( $text ) );
}
- function testUpdateText() {
+ public function testUpdateText() {
$this->assertEquals(
'test',
$this->updateText( '<div>TeSt</div>' ),
);
}
- function testBug32712() {
+ public function testBug32712() {
$text = "text „http://example.com“ text";
$result = $this->updateText( $text );
$processed = preg_replace( '/Q/u', 'Q', $result );
* Test SQL for each of our QueryPages objects
* @group Database
*/
- function testQuerypageSqlQuery() {
+ public function testQuerypageSqlQuery() {
global $wgDBtype;
foreach ( $this->queryPages as $page ) {
*
* Test specifications by Alexandre "ialex" Emsenhuber.
*/
- function testBug41337() {
+ public function testBug41337() {
// Set a low limit
$this->setMwGlobals( 'wgMaxSigChars', 2 );
* @param $expectedProfile An expected search profile name
* @param $expectedNs Array Expected namespaces
*/
- function testProfileAndNamespaceLoading(
+ public function testProfileAndNamespaceLoading(
$requested, $userOptions, $expectedProfile, $expectedNS,
$message = 'Profile name and namespaces mismatches!'
) {
* Verify we do not expand search term in <title> on search result page
* https://gerrit.wikimedia.org/r/4841
*/
- function testSearchTermIsNotExpanded() {
+ public function testSearchTermIsNotExpanded() {
# Initialize [[Special::Search]]
$search = new SpecialSearch();