http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88679

Revision: 88679
Author:   brion
Date:     2011-05-23 20:24:09 +0000 (Mon, 23 May 2011)
Log Message:
-----------
Follow-up to r88667; finish reverting bogus test cases from r87964. It looks 
like these cases need to be re-added, but correctly; for instance getLocalUrl() 
**DOES NOT** return something in $wgArticlePath space when an action is given 
that's not view. It **MUST** return the matching $wgActionPath or else use 
$wgScript directly, to ensure that URL structuring rules & security rules are 
followed.

Modified Paths:
--------------
    trunk/phase3/tests/phpunit/includes/TitleTest.php

Modified: trunk/phase3/tests/phpunit/includes/TitleTest.php
===================================================================
--- trunk/phase3/tests/phpunit/includes/TitleTest.php   2011-05-23 20:21:22 UTC 
(rev 88678)
+++ trunk/phase3/tests/phpunit/includes/TitleTest.php   2011-05-23 20:24:09 UTC 
(rev 88679)
@@ -15,108 +15,4 @@
                }
        }
 
-       /**
-        * Helper to test getLocalURL
-        *
-        * @cover Title:getLocalURL
-        */
-       function assertGetLocalURL( $expected, $dbkey, $query, $articlepath, 
$actionpaths = array(), $variant = false )
-       {
-               global $wgArticlePath;
-               $wgArticlePath = $articlepath;
-               global $wgActionPaths;
-               $wgActionPaths = $actionpaths;
-
-               $t = Title::newFromDBKey( $dbkey );
-
-               $this->assertEquals( $expected, $t->getLocalURL( $query, 
$variant ) );
-       }
-       
-       /**
-        * @dataProvider provider1
-        * @cover Title:getLocalURL
-        */
-       function testGetLocalUrl( $expected, $dbkey, $query ) 
-       {
-               $this->assertGetLocalURL( $expected, $dbkey, $query, '/wiki/$1' 
);
-       }
-
-       function provider1()
-       {
-               return array(
-                       array( '/wiki/Recentchanges', 'Recentchanges', '' ),
-                       array( '/wiki/Recentchanges?foo=2', 'Recentchanges', 
'foo=2' ),
-                       array( '/wiki/Recentchanges?foo=A&bar=1', 
'Recentchanges', 'foo=A&bar=1' ),
-               );
-       }
-
-
-       /**
-        * @dataProvider provider2
-        * @cover Title:getLocalURL
-        */
-       function testGetLocalUrlWithArticlePath( $expected, $dbkey, $query, 
$actions ) 
-       {
-               $this->assertGetLocalURL( $expected, $dbkey, $query, 
'/wiki/view/$1', $actions );
-       }
-
-       function provider2()
-       {
-               return array(
-                       array( '/wiki/view/Recentchanges', 'Recentchanges', '', 
array( ) ),
-                       array( '/wiki/view/Recentchanges', 'Recentchanges', '', 
array( 'view' => 'OH MEN' ) ),
-                       array( '/wiki/view/Recentchanges', 'Recentchanges', '', 
array( 'view' => '/wiki/view/$1' ) ),
-                       array( '/wiki/view/Recentchanges?foo=2', 
'Recentchanges', 'foo=2', array( 'view' => '/wiki/view/$1' ) ),
-                       array( '/wiki/view/Recentchanges?foo=A&bar=1', 
'Recentchanges', 'foo=A&bar=1', array() ),
-               );
-       }
-
-
-       /**
-        * @dataProvider provider3
-        * @cover Title:getLocalURL
-        */
-       function testGetLocalUrlWithActionPaths( $expected, $dbkey, $query ) 
-       {
-               $actions = array( 'edit' => '/wiki/edit/$1' );
-               $this->assertGetLocalURL( $expected, $dbkey, $query, 
'/wiki/view/$1', $actions );
-       }
-
-       function provider3() {
-               return array(
-                       array( '/wiki/view/Recentchanges', 'Recentchanges', ''),
-                       array( '/wiki/edit/Recentchanges', 'Recentchanges', 
'action=edit' ),
-                       array( '/wiki/edit/Recentchanges?foo=2', 
'Recentchanges', 'action=edit&foo=2' ),
-                       array( '/wiki/edit/Recentchanges?foo=2', 
'Recentchanges', 'foo=2&action=edit' ),
-                       array( '/wiki/view/Recentchanges?foo=A&bar=1', 
'Recentchanges', 'foo=A&bar=1' ),
-                       array( '/wiki/edit/Recentchanges?foo=A&bar=1', 
'Recentchanges', 'foo=A&bar=1&action=edit' ),
-                       array( '/wiki/edit/Recentchanges?foo=A&bar=1', 
'Recentchanges', 'foo=A&action=edit&bar=1' ),
-                       array( '/wiki/edit/Recentchanges?foo=A&bar=1', 
'Recentchanges', 'action=edit&foo=A&bar=1' ),
-
-                       # @todo FIXME: The next two are equals but need 
investigation:
-                       array( '/wiki/edit/Recentchanges', 'Recentchanges', 
'action=view&action=edit' ),
-                       array( 
'/wiki/view/Recentchanges?action=edit&action=view', 'Recentchanges', 
'action=edit&action=view' ),
-               );
-       }
-
-       /**
-        * @dataProvider provider4
-        * @cover Title:getLocalURL
-        */
-       function testGetLocalUrlWithVariantArticlePaths( $expected, $dbkey, 
$query )
-       {
-               # @todo FIXME: Find a language with variants!
-               $this->markTestIncomplete();
-
-               $actions = array( 'edit' => '/wiki/edit/$1' );
-               $this->assertGetLocalURL( $expected, $dbkey, $query, 
'/wiki/view/$1', array(), '/$2/$1' );
-       }
-
-       function provider4() {
-               return array(
-                       array( '/wiki/view/Recentchanges', 'Recentchanges', '', 
),
-               );
-       }
-
-
 }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to