r92234 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92233‎ | r92234 | r92235 >
Date:09:45, 15 July 2011
Author:hashar
Status:resolved (Comments)
Tags:
Comment:
NS_MAIN can locally have subpages enabled

This workaround test if any local change has been made, if so the test
will be skipped.

fu r82577
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/MWNamespaceTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/MWNamespaceTest.php
@@ -271,7 +271,14 @@
272272 $this->assertFalse( MWNamespace::hasSubpages( NS_SPECIAL ) );
273273
274274 // namespaces without subpages
275 - $this->assertFalse( MWNamespace::hasSubpages( NS_MAIN ) );
 275+ global $wgNamespacesWithSubpages;
 276+ if( array_key_exists( NS_MAIN, $wgNamespacesWithSubpages )
 277+ && $wgNamespacesWithSubpages[NS_MAIN] === true
 278+ ) {
 279+ $this->markTestSkipped( "Main namespace has subpages enabled" );
 280+ } else {
 281+ $this->assertFalse( MWNamespace::hasSubpages( NS_MAIN ) );
 282+ }
276283
277284 // Some namespaces with subpages
278285 $this->assertTrue( MWNamespace::hasSubpages( NS_TALK ) );

Follow-up revisions

RevisionCommit summaryAuthorDate
r94517Fix up NS_MAIN subpage tests...hashar14:17, 15 August 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82577improve namespace related methods...hashar22:17, 21 February 2011

Comments

#Comment by Nikerabbit (talk | contribs)   11:28, 15 July 2011

Shouldn't the test just setup an environment it expects?

#Comment by Hashar (talk | contribs)   12:46, 15 July 2011

That would be correct way to test it indeed :-)

#Comment by 😂 (talk | contribs)   13:00, 15 July 2011

Rather than skipping it, you could test if hasSubpagesEnabled() is true :)

#Comment by Hashar (talk | contribs)   14:18, 15 August 2011

resetting to 'new' per r94517

Status & tagging log