$this->context->setTitle( Title::newFromText( 'Test' ) );
$this->context->setUser( $user );
- $this->setMwGlobals( array(
+ $this->setMwGlobals( [
'wgUser' => $user,
- 'wgTextModelsToParse' => array(
+ 'wgTextModelsToParse' => [
CONTENT_MODEL_WIKITEXT,
CONTENT_MODEL_CSS,
CONTENT_MODEL_JAVASCRIPT,
- ),
+ ],
'wgUseTidy' => false,
'wgCapitalLinks' => true,
- 'wgHooks' => array(), // bypass hook ContentGetParserOutput that force custom rendering
- ) );
+ 'wgHooks' => [], // bypass hook ContentGetParserOutput that force custom rendering
+ ] );
MWTidy::destroySingleton();
}
}
public static function dataGetParserOutput() {
- return array(
- array(
+ return [
+ [
'TextContentTest_testGetParserOutput',
CONTENT_MODEL_TEXT,
"hello ''world'' & [[stuff]]\n", "hello ''world'' & [[stuff]]",
- array(
- 'Links' => array()
- )
- ),
+ [
+ 'Links' => []
+ ]
+ ],
// TODO: more...?
- );
+ ];
}
/**
if ( $expectedFields ) {
foreach ( $expectedFields as $field => $exp ) {
$f = 'get' . ucfirst( $field );
- $v = call_user_func( array( $po, $f ) );
+ $v = call_user_func( [ $po, $f ] );
if ( is_array( $exp ) ) {
$this->assertArrayEquals( $exp, $v );
}
public static function dataPreSaveTransform() {
- return array(
- array(
- #0: no signature resolution
+ return [
+ [
+ # 0: no signature resolution
'hello this is ~~~',
'hello this is ~~~',
- ),
- array(
- #1: rtrim
+ ],
+ [
+ # 1: rtrim
" Foo \n ",
' Foo',
- ),
- );
+ ],
+ ];
}
/**
}
public static function dataPreloadTransform() {
- return array(
- array(
+ return [
+ [
'hello this is ~~~',
'hello this is ~~~',
- ),
- );
+ ],
+ ];
}
/**
}
public static function dataGetRedirectTarget() {
- return array(
- array( '#REDIRECT [[Test]]',
+ return [
+ [ '#REDIRECT [[Test]]',
null,
- ),
- );
+ ],
+ ];
}
/**
$this->assertEquals( !is_null( $expected ), $content->isRedirect() );
}
- /**
- * @todo Test needs database! Should be done by a test class in the Database group.
- */
- /*
- public function getRedirectChain() {
- $text = $this->getNativeData();
- return Title::newFromRedirectArray( $text );
- }
- */
-
/**
* @todo Test needs database! Should be done by a test class in the Database group.
*/
*/
public static function dataIsCountable() {
- return array(
- array( '',
+ return [
+ [ '',
null,
'any',
true
- ),
- array( 'Foo',
+ ],
+ [ 'Foo',
null,
'any',
true
- ),
- array( 'Foo',
+ ],
+ [ 'Foo',
null,
'comma',
false
- ),
- array( 'Foo, bar',
+ ],
+ [ 'Foo, bar',
null,
'comma',
false
- ),
- );
+ ],
+ ];
}
/**
}
public static function dataGetTextForSummary() {
- return array(
- array( "hello\nworld.",
+ return [
+ [ "hello\nworld.",
16,
'hello world.',
- ),
- array( 'hello world.',
+ ],
+ [ 'hello world.',
8,
'hello...',
- ),
- array( '[[hello world]].',
+ ],
+ [ '[[hello world]].',
8,
'[[hel...',
- ),
- );
+ ],
+ ];
}
/**
}
public static function dataIsEmpty() {
- return array(
- array( '', true ),
- array( ' ', false ),
- array( '0', false ),
- array( 'hallo welt.', false ),
- );
+ return [
+ [ '', true ],
+ [ ' ', false ],
+ [ '0', false ],
+ [ 'hallo welt.', false ],
+ ];
}
/**
}
public static function dataEquals() {
- return array(
- array( new TextContent( "hallo" ), null, false ),
- array( new TextContent( "hallo" ), new TextContent( "hallo" ), true ),
- array( new TextContent( "hallo" ), new JavaScriptContent( "hallo" ), false ),
- array( new TextContent( "hallo" ), new WikitextContent( "hallo" ), false ),
- array( new TextContent( "hallo" ), new TextContent( "HALLO" ), false ),
- );
+ return [
+ [ new TextContent( "hallo" ), null, false ],
+ [ new TextContent( "hallo" ), new TextContent( "hallo" ), true ],
+ [ new TextContent( "hallo" ), new JavaScriptContent( "hallo" ), false ],
+ [ new TextContent( "hallo" ), new WikitextContent( "hallo" ), false ],
+ [ new TextContent( "hallo" ), new TextContent( "HALLO" ), false ],
+ ];
}
/**
}
public static function dataGetDeletionUpdates() {
- return array(
- array( "TextContentTest_testGetSecondaryDataUpdates_1",
+ return [
+ [ "TextContentTest_testGetSecondaryDataUpdates_1",
CONTENT_MODEL_TEXT, "hello ''world''\n",
- array()
- ),
- array( "TextContentTest_testGetSecondaryDataUpdates_2",
+ []
+ ],
+ [ "TextContentTest_testGetSecondaryDataUpdates_2",
CONTENT_MODEL_TEXT, "hello [[world test 21344]]\n",
- array()
- ),
+ []
+ ],
// TODO: more...?
- );
+ ];
}
/**
$update = $updates[$class];
foreach ( $fieldValues as $field => $value ) {
- $v = $update->$field; #if the field doesn't exist, just crash and burn
+ $v = $update->$field; # if the field doesn't exist, just crash and burn
$this->assertEquals( $value, $v, "unexpected value for field $field in instance of $class" );
}
}
}
public static function provideConvert() {
- return array(
- array( // #0
+ return [
+ [ // #0
'Hallo Welt',
CONTENT_MODEL_WIKITEXT,
'lossless',
'Hallo Welt'
- ),
- array( // #1
+ ],
+ [ // #1
'Hallo Welt',
CONTENT_MODEL_WIKITEXT,
'lossless',
'Hallo Welt'
- ),
- array( // #1
+ ],
+ [ // #1
'Hallo Welt',
CONTENT_MODEL_CSS,
'lossless',
'Hallo Welt'
- ),
- array( // #1
+ ],
+ [ // #1
'Hallo Welt',
CONTENT_MODEL_JAVASCRIPT,
'lossless',
'Hallo Welt'
- ),
- );
+ ],
+ ];
}
/**