http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97859
Revision: 97859
Author: brion
Date: 2011-09-22 21:39:28 +0000 (Thu, 22 Sep 2011)
Log Message:
-----------
MFT r97857 to 1.18wmf1 -- regression from r86255 (bug 31100)
Modified Paths:
--------------
branches/wmf/1.18wmf1/includes/Title.php
branches/wmf/1.18wmf1/tests/phpunit/includes/TitleTest.php
Modified: branches/wmf/1.18wmf1/includes/Title.php
===================================================================
--- branches/wmf/1.18wmf1/includes/Title.php 2011-09-22 21:38:46 UTC (rev
97858)
+++ branches/wmf/1.18wmf1/includes/Title.php 2011-09-22 21:39:28 UTC (rev
97859)
@@ -4114,9 +4114,9 @@
*/
public function fixSpecialName() {
if ( $this->getNamespace() == NS_SPECIAL ) {
- list( $canonicalName, /*...*/ ) =
SpecialPageFactory::resolveAlias( $this->mDbkeyform );
+ list( $canonicalName, $par ) =
SpecialPageFactory::resolveAlias( $this->mDbkeyform );
if ( $canonicalName ) {
- $localName =
SpecialPageFactory::getLocalNameFor( $canonicalName );
+ $localName =
SpecialPageFactory::getLocalNameFor( $canonicalName, $par );
if ( $localName != $this->mDbkeyform ) {
return Title::makeTitle( NS_SPECIAL,
$localName );
}
Modified: branches/wmf/1.18wmf1/tests/phpunit/includes/TitleTest.php
===================================================================
--- branches/wmf/1.18wmf1/tests/phpunit/includes/TitleTest.php 2011-09-22
21:38:46 UTC (rev 97858)
+++ branches/wmf/1.18wmf1/tests/phpunit/includes/TitleTest.php 2011-09-22
21:39:28 UTC (rev 97859)
@@ -15,4 +15,26 @@
}
}
+ /**
+ * @dataProvider dataBug31100
+ */
+ function testBug31100FixSpecialName( $text, $expectedParam ) {
+ $title = Title::newFromText( $text );
+ $fixed = $title->fixSpecialName();
+ $stuff = explode( '/', $fixed->getDbKey(), 2 );
+ if ( count( $stuff ) == 2 ) {
+ $par = $stuff[1];
+ } else {
+ $par = null;
+ }
+ $this->assertEquals( $expectedParam, $par, "Bug 31100
regression check: Title->fixSpecialName() should preserve parameter" );
+ }
+
+ function dataBug31100() {
+ return array(
+ array( 'Special:Version', null ),
+ array( 'Special:Version/', '' ),
+ array( 'Special:Version/param', 'param' ),
+ );
+ }
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs