Remove Title::newFromRedirectArray
[lhc/web/wiklou.git] / tests / phpunit / includes / content / TextContentTest.php
index 06609d8..d89f3eb 100644 (file)
@@ -19,17 +19,17 @@ class TextContentTest extends MediaWikiLangTestCase {
                $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();
        }
@@ -44,17 +44,17 @@ class TextContentTest extends MediaWikiLangTestCase {
        }
 
        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...?
-               );
+               ];
        }
 
        /**
@@ -77,7 +77,7 @@ class TextContentTest extends MediaWikiLangTestCase {
                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 );
@@ -91,18 +91,18 @@ class TextContentTest extends MediaWikiLangTestCase {
        }
 
        public static function dataPreSaveTransform() {
-               return array(
-                       array(
+               return [
+                       [
                                # 0: no signature resolution
                                'hello this is ~~~',
                                'hello this is ~~~',
-                       ),
-                       array(
+                       ],
+                       [
                                # 1: rtrim
                                " Foo \n ",
                                ' Foo',
-                       ),
-               );
+                       ],
+               ];
        }
 
        /**
@@ -125,12 +125,12 @@ class TextContentTest extends MediaWikiLangTestCase {
        }
 
        public static function dataPreloadTransform() {
-               return array(
-                       array(
+               return [
+                       [
                                'hello this is ~~~',
                                'hello this is ~~~',
-                       ),
-               );
+                       ],
+               ];
        }
 
        /**
@@ -148,11 +148,11 @@ class TextContentTest extends MediaWikiLangTestCase {
        }
 
        public static function dataGetRedirectTarget() {
-               return array(
-                       array( '#REDIRECT [[Test]]',
+               return [
+                       [ '#REDIRECT [[Test]]',
                                null,
-                       ),
-               );
+                       ],
+               ];
        }
 
        /**
@@ -180,16 +180,6 @@ class TextContentTest extends MediaWikiLangTestCase {
                $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.
         */
@@ -201,28 +191,28 @@ class TextContentTest extends MediaWikiLangTestCase {
        */
 
        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
-                       ),
-               );
+                       ],
+               ];
        }
 
        /**
@@ -247,20 +237,20 @@ class TextContentTest extends MediaWikiLangTestCase {
        }
 
        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...',
-                       ),
-               );
+                       ],
+               ];
        }
 
        /**
@@ -339,12 +329,12 @@ class TextContentTest extends MediaWikiLangTestCase {
        }
 
        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 ],
+               ];
        }
 
        /**
@@ -358,13 +348,13 @@ class TextContentTest extends MediaWikiLangTestCase {
        }
 
        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 ],
+               ];
        }
 
        /**
@@ -376,17 +366,17 @@ class TextContentTest extends MediaWikiLangTestCase {
        }
 
        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...?
-               );
+               ];
        }
 
        /**
@@ -430,32 +420,32 @@ class TextContentTest extends MediaWikiLangTestCase {
        }
 
        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'
-                       ),
-               );
+                       ],
+               ];
        }
 
        /**