Add unit test for MWNamespace::isNonincludable
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 11 May 2012 17:52:34 +0000 (19:52 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Fri, 11 May 2012 17:52:34 +0000 (19:52 +0200)
rename MWNamespace::isNonincludableNamespace
to MWNamespace::isNonincludable, because "Namespace" is already in the
class name

Change-Id: Ie982835c7dc84cb10c823996e5360cc1b342f704

includes/Namespace.php
includes/api/ApiQuerySiteinfo.php
includes/parser/Parser.php
tests/phpunit/includes/MWNamespaceTest.php

index bdccca1..9ec6948 100644 (file)
@@ -361,7 +361,7 @@ class MWNamespace {
         * @param $index int Index to check
         * @return bool
         */
-       public static function isNonincludableNamespace( $index ) {
+       public static function isNonincludable( $index ) {
                global $wgNonincludableNamespaces;
                return $wgNonincludableNamespaces && in_array( $index, $wgNonincludableNamespaces );
        }
index fc5d7bb..e7102e0 100644 (file)
@@ -216,7 +216,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                                $data[$ns]['content'] = '';
                        }
 
-                       if ( MWNamespace::isNonincludableNamespace( $ns ) ) {
+                       if ( MWNamespace::isNonincludable( $ns ) ) {
                                $data[$ns]['nonincludable'] = '';
                        }
                }
index ba7ff60..fa98dbf 100644 (file)
@@ -3309,7 +3309,7 @@ class Parser {
                                                $isHTML = true;
                                                $this->disableCache();
                                        }
-                               } elseif ( MWNamespace::isNonincludableNamespace( $title->getNamespace() ) ) {
+                               } elseif ( MWNamespace::isNonincludable( $title->getNamespace() ) ) {
                                        $found = false; # access denied
                                        wfDebug( __METHOD__.": template inclusion denied for " . $title->getPrefixedDBkey() );
                                } else {
index d459022..da36ffd 100644 (file)
@@ -546,6 +546,15 @@ class MWNamespaceTest extends MediaWikiTestCase {
 
        }
 
+       public function testIsNonincludable() {
+               global $wgNonincludableNamespaces;
+               $wgNonincludableNamespaces = array( NS_USER );
+
+               $this->assertTrue( MWNamespace::isNonincludable( NS_USER ) );
+
+               $this->assertFalse( MWNamespace::isNonincludable( NS_TEMPLATE ) );
+       }
+
        ####### HELPERS ###########################################################
        function __call( $method, $args ) {
                // Call the real method if it exists