Merge "Remove deprecated RawPage class"
[lhc/web/wiklou.git] / tests / phpunit / includes / TitleTest.php
index 8093824..6871582 100644 (file)
@@ -29,9 +29,15 @@ class TitleTest extends MediaWikiTestCase {
                foreach ( range( 1, 255 ) as $num ) {
                        $chr = chr( $num );
                        if ( strpos( "#[]{}<>|", $chr ) !== false || preg_match( "/[\\x00-\\x1f\\x7f]/", $chr ) ) {
-                               $this->assertFalse( (bool)preg_match( "/[$titlechars]/", $chr ), "chr($num) = $chr is not a valid titlechar" );
+                               $this->assertFalse(
+                                       (bool)preg_match( "/[$titlechars]/", $chr ),
+                                       "chr($num) = $chr is not a valid titlechar"
+                               );
                        } else {
-                               $this->assertTrue( (bool)preg_match( "/[$titlechars]/", $chr ), "chr($num) = $chr is a valid titlechar" );
+                               $this->assertTrue(
+                                       (bool)preg_match( "/[$titlechars]/", $chr ),
+                                       "chr($num) = $chr is a valid titlechar"
+                               );
                        }
                }
        }
@@ -75,11 +81,13 @@ class TitleTest extends MediaWikiTestCase {
                        'Foo/.../Sandbox',
                        'Sandbox/...',
                        'A~~',
+                       ':A',
                        // Length is 256 total, but only title part matters
                        'Category:' . str_repeat( 'x', 248 ),
                        str_repeat( 'x', 252 ),
                        // interwiki prefix
                        'localtestiw: #anchor',
+                       'localtestiw:',
                        'localtestiw:foo',
                        'localtestiw: foo # anchor',
                        'localtestiw: Talk: Sandbox # anchor',
@@ -87,7 +95,9 @@ class TitleTest extends MediaWikiTestCase {
                        'remotetestiw: Talk: # anchor',
                        'remotetestiw: #bar',
                        'remotetestiw: Talk:',
-                       'remotetestiw: Talk: Foo'
+                       'remotetestiw: Talk: Foo',
+                       'localtestiw:remotetestiw:',
+                       'localtestiw:remotetestiw:foo'
                ) as $text ) {
                        $this->assertInstanceOf( 'Title', Title::newFromText( $text ), "Valid: $text" );
                }
@@ -138,7 +148,6 @@ class TitleTest extends MediaWikiTestCase {
                        'Category: ',
                        'Category: #bar',
                        // interwiki prefix
-                       'localtestiw:',
                        'localtestiw: Talk: # anchor',
                        'localtestiw: Talk:'
                ) as $text ) {
@@ -229,7 +238,11 @@ class TitleTest extends MediaWikiTestCase {
                } else {
                        $par = null;
                }
-               $this->assertEquals( $expectedParam, $par, "Bug 31100 regression check: Title->fixSpecialName() should preserve parameter" );
+               $this->assertEquals(
+                       $expectedParam,
+                       $par,
+                       "Bug 31100 regression check: Title->fixSpecialName() should preserve parameter"
+               );
        }
 
        public static function provideBug31100() {
@@ -330,7 +343,11 @@ class TitleTest extends MediaWikiTestCase {
                        $allowableness = $expected
                                ? " should be allowed"
                                : " should NOT be allowed";
-                       $this->assertEquals( $expected, $errors, "User action '$action' on [[$source]] $allowableness." );
+                       $this->assertEquals(
+                               $expected,
+                               $errors,
+                               "User action '$action' on [[$source]] $allowableness."
+                       );
                } else {
                        $errors = $this->flattenErrorsArray( $errors );
                        foreach ( (array)$expected as $error ) {
@@ -398,7 +415,9 @@ class TitleTest extends MediaWikiTestCase {
         * @dataProvider provideGetPageViewLanguage
         * @covers Title::getPageViewLanguage
         */
-       public function testGetPageViewLanguage( $expected, $titleText, $contLang, $lang, $variant, $msg = '' ) {
+       public function testGetPageViewLanguage( $expected, $titleText, $contLang,
+               $lang, $variant, $msg = ''
+       ) {
                global $wgLanguageCode, $wgContLang, $wgLang, $wgDefaultLanguageVariant, $wgAllowUserJs;
 
                // Setup environnement for this test
@@ -580,8 +599,8 @@ class TitleTest extends MediaWikiTestCase {
        /**
         * @dataProvider provideGetFragment
         *
-        * @param $full
-        * @param $fragment
+        * @param string $full
+        * @param string $fragment
         */
        public function testGetFragment( $full, $fragment ) {
                $title = Title::newFromText( $full );