Merge "resourceloader: Don't add superfluous line breaks and semicolons"
[lhc/web/wiklou.git] / tests / phpunit / skins / SideBarTest.php
index 7d33a59..3fb487c 100644 (file)
@@ -15,7 +15,8 @@ class SideBarTest extends MediaWikiLangTestCase {
 
        /** Build $this->messages array */
        private function initMessagesHref() {
-               # List of default messages for the sidebar:
+               # List of default messages for the sidebar. The sidebar doesn't care at
+               # all whether they are full URLs, interwiki links or local titles.
                $URL_messages = array(
                        'mainpage',
                        'portal-url',
@@ -25,10 +26,16 @@ class SideBarTest extends MediaWikiLangTestCase {
                        'helppage',
                );
 
+               # We're assuming that isValidURI works as advertised: it's also
+               # tested separately, in tests/phpunit/includes/HttpTest.php.
                foreach ( $URL_messages as $m ) {
                        $titleName = MessageCache::singleton()->get( $m );
-                       $title = Title::newFromText( $titleName );
-                       $this->messages[$m]['href'] = $title->getLocalURL();
+                       if ( Http::isValidURI( $titleName ) ) {
+                               $this->messages[$m]['href'] = $titleName;
+                       } else {
+                               $title = Title::newFromText( $titleName );
+                               $this->messages[$m]['href'] = $title->getLocalURL();
+                       }
                }
        }