r94517 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94516‎ | r94517 | r94518 >
Date:14:17, 15 August 2011
Author:hashar
Status:ok (Comments)
Tags:
Comment:
Fix up NS_MAIN subpage tests

Per CR on r92234, this correctly test hasSubpages independently from your
local configuration. Also test altering the global and having static
methods reacting accordingly.
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/MWNamespaceTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/MWNamespaceTest.php
@@ -276,15 +276,26 @@
277277 $this->assertFalse( MWNamespace::hasSubpages( NS_SPECIAL ) );
278278
279279 // namespaces without subpages
 280+ # save up global
280281 global $wgNamespacesWithSubpages;
281 - if( array_key_exists( NS_MAIN, $wgNamespacesWithSubpages )
282 - && $wgNamespacesWithSubpages[NS_MAIN] === true
283 - ) {
284 - $this->markTestSkipped( "Main namespace has subpages enabled" );
285 - } else {
286 - $this->assertFalse( MWNamespace::hasSubpages( NS_MAIN ) );
 282+ $saved = null;
 283+ if( array_key_exists( NS_MAIN, $wgNamespacesWithSubpages ) ) {
 284+ $saved = $wgNamespacesWithSubpages[NS_MAIN];
 285+ unset( $wgNamespacesWithSubpages[NS_MAIN] );
287286 }
288287
 288+ $this->assertFalse( MWNamespace::hasSubpages( NS_MAIN ) );
 289+
 290+ $wgNamespacesWithSubpages[NS_MAIN] = true;
 291+ $this->assertTrue( MWNamespace::hasSubpages( NS_MAIN ) );
 292+ $wgNamespacesWithSubpages[NS_MAIN] = false;
 293+ $this->assertFalse( MWNamespace::hasSubpages( NS_MAIN ) );
 294+
 295+ # restore global
 296+ if( $saved !== null ) {
 297+ $wgNamespacesWithSubpages[NS_MAIN] = $saved;
 298+ }
 299+
289300 // Some namespaces with subpages
290301 $this->assertTrue( MWNamespace::hasSubpages( NS_TALK ) );
291302 $this->assertTrue( MWNamespace::hasSubpages( NS_USER ) );

Follow-up revisions

RevisionCommit summaryAuthorDate
r95632MFT to REL1_18...hashar17:57, 28 August 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92234NS_MAIN can locally have subpages enabled...hashar09:45, 15 July 2011

Comments

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

Tagging 1.18. Not really needed but would be nice :-)

Status & tagging log