*/
class TagHookTest extends MediaWikiTestCase {
public static function provideValidNames() {
- return array( array( 'foo' ), array( 'foo-bar' ), array( 'foo_bar' ), array( 'FOO-BAR' ), array( 'foo bar' ) );
+ return array(
+ array( 'foo' ),
+ array( 'foo-bar' ),
+ array( 'foo_bar' ),
+ array( 'FOO-BAR' ),
+ array( 'foo bar' )
+ );
}
public static function provideBadNames() {
$parser = new Parser( $wgParserConf );
$parser->setHook( $tag, array( $this, 'tagCallback' ) );
- $parserOutput = $parser->parse( "Foo<$tag>Bar</$tag>Baz", Title::newFromText( 'Test' ), ParserOptions::newFromUserAndLang( new User, $wgContLang ) );
+ $parserOutput = $parser->parse(
+ "Foo<$tag>Bar</$tag>Baz",
+ Title::newFromText( 'Test' ),
+ ParserOptions::newFromUserAndLang( new User, $wgContLang )
+ );
$this->assertEquals( "<p>FooOneBaz\n</p>", $parserOutput->getText() );
$parser->mPreprocessor = null; # Break the Parser <-> Preprocessor cycle
$parser = new Parser( $wgParserConf );
$parser->setHook( $tag, array( $this, 'tagCallback' ) );
- $parser->parse( "Foo<$tag>Bar</$tag>Baz", Title::newFromText( 'Test' ), ParserOptions::newFromUserAndLang( new User, $wgContLang ) );
+ $parser->parse(
+ "Foo<$tag>Bar</$tag>Baz",
+ Title::newFromText( 'Test' ),
+ ParserOptions::newFromUserAndLang( new User, $wgContLang )
+ );
$this->fail( 'Exception not thrown.' );
}
$parser = new Parser( $wgParserConf );
$parser->setFunctionTagHook( $tag, array( $this, 'functionTagCallback' ), 0 );
- $parserOutput = $parser->parse( "Foo<$tag>Bar</$tag>Baz", Title::newFromText( 'Test' ), ParserOptions::newFromUserAndLang( new User, $wgContLang ) );
+ $parserOutput = $parser->parse(
+ "Foo<$tag>Bar</$tag>Baz",
+ Title::newFromText( 'Test' ),
+ ParserOptions::newFromUserAndLang( new User, $wgContLang )
+ );
$this->assertEquals( "<p>FooOneBaz\n</p>", $parserOutput->getText() );
$parser->mPreprocessor = null; # Break the Parser <-> Preprocessor cycle
$parser = new Parser( $wgParserConf );
$parser->setFunctionTagHook( $tag, array( $this, 'functionTagCallback' ), SFH_OBJECT_ARGS );
- $parser->parse( "Foo<$tag>Bar</$tag>Baz", Title::newFromText( 'Test' ), ParserOptions::newFromUserAndLang( new User, $wgContLang ) );
+ $parser->parse(
+ "Foo<$tag>Bar</$tag>Baz",
+ Title::newFromText( 'Test' ),
+ ParserOptions::newFromUserAndLang( new User, $wgContLang )
+ );
$this->fail( 'Exception not thrown.' );
}
/* Test Methods */
/**
- * Ensures that the ResourceLoaderRegisterModules hook is called when a new ResourceLoader object is constructed
+ * Ensures that the ResourceLoaderRegisterModules hook is called when a new
+ * ResourceLoader object is constructed.
* @covers ResourceLoader::__construct
*/
public function testCreatingNewResourceLoaderCallsRegistrationHook() {
}
$this->insertPage( "Not_Main_Page", "This is not a main page", 0 );
- $this->insertPage( 'Talk:Not_Main_Page', 'This is not a talk page to the main page, see [[smithee]]', 1 );
+ $this->insertPage(
+ 'Talk:Not_Main_Page',
+ 'This is not a talk page to the main page, see [[smithee]]',
+ 1
+ );
$this->insertPage( 'Smithee', 'A smithee is one who smiths. See also [[Alan Smithee]]', 0 );
$this->insertPage( 'Talk:Smithee', 'This article sucks.', 1 );
$this->insertPage( 'Unrelated_page', 'Nothing in this page is about the S word.', 0 );
// url, filepath, path arg, expected
array( 'https://en.wikipedia.org', '/w/$1', 'api.php', 'https://en.wikipedia.org/w/api.php' ),
array( 'https://en.wikipedia.org', '/w/', 'api.php', 'https://en.wikipedia.org/w/' ),
- array( 'https://en.wikipedia.org', '/foo/page.php?name=$1', 'api.php', 'https://en.wikipedia.org/foo/page.php?name=api.php' ),
- array( 'https://en.wikipedia.org', '/w/$1', '', 'https://en.wikipedia.org/w/' ),
- array( 'https://en.wikipedia.org', '/w/$1', 'foo/bar/api.php', 'https://en.wikipedia.org/w/foo/bar/api.php' ),
+ array(
+ 'https://en.wikipedia.org',
+ '/foo/page.php?name=$1',
+ 'api.php',
+ 'https://en.wikipedia.org/foo/page.php?name=api.php'
+ ),
+ array(
+ 'https://en.wikipedia.org',
+ '/w/$1',
+ '',
+ 'https://en.wikipedia.org/w/'
+ ),
+ array(
+ 'https://en.wikipedia.org',
+ '/w/$1',
+ 'foo/bar/api.php',
+ 'https://en.wikipedia.org/w/foo/bar/api.php'
+ ),
);
}
global $wgDBtype;
foreach ( $this->queryPages as $page ) {
-
// With MySQL, skips special pages reopening a temporary table
// See http://bugs.mysql.com/bug.php?id=10327
if (
$wgDBtype === 'mysql'
&& in_array( $page->getName(), $this->reopensTempTable )
) {
- $this->markTestSkipped( "SQL query for page {$page->getName()} can not be tested on MySQL backend (it reopens a temporary table)" );
+ $this->markTestSkipped( "SQL query for page {$page->getName()} "
+ . "can not be tested on MySQL backend (it reopens a temporary table)" );
continue;
}
/**
* @covers SpecialSearch::load
* @dataProvider provideSearchOptionsTests
- * @param array $requested Request parameters. For example array( 'ns5' => true, 'ns6' => true). Null to use default options.
- * @param array $userOptions User options to test with. For example array('searchNs5' => 1 );. Null to use default options.
+ * @param array $requested Request parameters. For example:
+ * array( 'ns5' => true, 'ns6' => true). Null to use default options.
+ * @param array $userOptions User options to test with. For example:
+ * array('searchNs5' => 1 );. Null to use default options.
* @param string $expectedProfile An expected search profile name
* @param array $expectedNs Expected namespaces
*/
- public function testProfileAndNamespaceLoading(
- $requested, $userOptions, $expectedProfile, $expectedNS,
- $message = 'Profile name and namespaces mismatches!'
+ public function testProfileAndNamespaceLoading( $requested, $userOptions,
+ $expectedProfile, $expectedNS, $message = 'Profile name and namespaces mismatches!'
) {
$context = new RequestContext;
$context->setUser(
array( NS_MAIN, 'Foo_Bar', '', 'en', 'Foo Bar' ),
array( NS_USER, 'Hansi_Maier', 'stuff_and_so_on', 'en', 'User:Hansi Maier#stuff and so on' ),
array( false, 'Hansi_Maier', '', 'en', 'Hansi Maier' ),
- array( NS_USER_TALK, 'hansi__maier', '', 'en', 'User talk:hansi maier', 'User talk:Hansi maier' ),
+ array(
+ NS_USER_TALK,
+ 'hansi__maier',
+ '',
+ 'en',
+ 'User talk:hansi maier',
+ 'User talk:Hansi maier'
+ ),
// getGenderCache() provides a mock that considers first
// names ending in "a" to be female.
// test round trip
$parsed = $codec->parseTitle( $actual, NS_MAIN );
- $actual2 = $codec->formatTitle( $parsed->getNamespace(), $parsed->getText(), $parsed->getFragment() );
+ $actual2 = $codec->formatTitle(
+ $parsed->getNamespace(),
+ $parsed->getText(),
+ $parsed->getFragment()
+ );
$this->assertEquals( $normalized, $actual2, 'normalized after round trip' );
}
}
}
- protected function doApiRequest( array $params, array $unused = null, $appendModule = false, User $user = null ) {
+ protected function doApiRequest( array $params, array $unused = null,
+ $appendModule = false, User $user = null
+ ) {
$sessionId = session_id();
session_write_close();
$page->doDeleteArticle( '' );
}
- $this->assertFalse( (bool)$talk->getArticleID( Title::GAID_FOR_UPDATE ), 'User talk does not exist' );
+ $this->assertFalse(
+ (bool)$talk->getArticleID( Title::GAID_FOR_UPDATE ),
+ 'User talk does not exist'
+ );
$this->doApiRequest( array(
'action' => 'upload',
) );
} catch ( UsageException $e ) {
$exception = true;
- $this->assertEquals( 'Using leavemessage without ignorewarnings is not supported', $e->getMessage() );
+ $this->assertEquals(
+ 'Using leavemessage without ignorewarnings is not supported',
+ $e->getMessage()
+ );
}
$this->assertTrue( $exception );
<?php
+// @codingStandardsIgnoreStart Ignore Squiz.Classes.ValidClassName.NotCamelCaps
class LanguageBe_taraskTest extends LanguageClassesTestCase {
+ // @codingStandardsIgnoreEnd
/**
* Make sure the language code we are given is indeed
* be-tarask. This is to ensure LanguageClassesTestCase
array( 'fr-Latn-F', 'region too short' ),
array( 'a-value', 'language too short with region' ),
array( 'tlh-a-b-foo', 'valid three-letter with wrong variant' ),
- array( 'i-notexist', 'grandfathered but not registered: invalid, even if we only test well-formedness' ),
+ array(
+ 'i-notexist',
+ 'grandfathered but not registered: invalid, even if we only test well-formedness'
+ ),
array( 'abcdefghi-012345678', 'numbers too long' ),
array( 'ab-abc-abc-abc-abc', 'invalid extensions' ),
array( 'ab-abcd-abc', 'invalid extensions' ),
*/
public function testKnownCldrLanguageTag() {
if ( !class_exists( 'LanguageNames' ) ) {
- $this->markTestSkipped( 'The LanguageNames class is not available. The cldr extension is probably not installed.' );
+ $this->markTestSkipped( 'The LanguageNames class is not available. '
+ . 'The CLDR extension is probably not installed.' );
}
$this->assertTrue(
(bool)Language::isKnownLanguageTag( 'pal' ),
- 'validating code "pal" an ancient language, which probably will not appear in Names.php, but appears in CLDR in English'
+ 'validating code "pal" an ancient language, which probably will '
+ . 'not appear in Names.php, but appears in CLDR in English'
);
}
'2009-W53-4',
'leap week'
),
- // What follows is mostly copied from https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23time
+ // What follows is mostly copied from
+ // https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23time
array(
'Y',
'20120102090705',
}
public static function provideCheckTitleEncodingData() {
+ // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
return array(
array( "" ),
array( "United States of America" ), // 7bit ASCII
)
)
);
+ // @codingStandardsIgnoreEnd
}
/**
array( array( 'formatDuration', 1023 * 60 * 60 ), '1023 hours', 'relative' ),
array( array( 'formatDuration', -1023 ), '-1023 seconds', 'negative relative' ),
array( array( 'formatDuration', 0 ), 'now', 'now' ),
- array( array( 'timeanddate', '20120102070000' ), '2012-1-1 7:00 +1 day', 'mixed, handled as absolute' ),
+ array(
+ array( 'timeanddate', '20120102070000' ),
+ '2012-1-1 7:00 +1 day',
+ 'mixed, handled as absolute'
+ ),
array( array( 'timeanddate', '19910203040506' ), '1991-2-3 4:05:06', 'absolute' ),
array( array( 'timeanddate', '19700101000000' ), '1970-1-1 0:00:00', 'absolute at epoch' ),
array( array( 'timeanddate', '19691231235959' ), '1969-12-31 23:59:59', 'time before epoch' ),
public static function provideGetParentLanguage() {
return array(
array( 'zh-cn', 'zh', 'zh is the parent language of zh-cn' ),
- array( 'zh', 'zh', 'zh is defined as the parent language of zh, because zh converter can convert zh-cn to zh' ),
+ array( 'zh', 'zh', 'zh is defined as the parent language of zh, '
+ . 'because zh converter can convert zh-cn to zh' ),
array( 'zh-invalid', null, 'do not be fooled by arbitrarily composed language codes' ),
array( 'en-gb', null, 'en does not have converter' ),
- array( 'en', null, 'en does not have converter. Although FakeConverter handles en -> en conversion but it is useless' ),
+ array( 'en', null, 'en does not have converter. Although FakeConverter '
+ . 'handles en -> en conversion but it is useless' ),
);
}