Revert "Make an empty "?action=" parameter default to "view""
authorKrinkle <krinklemail@gmail.com>
Wed, 18 May 2016 18:54:50 +0000 (18:54 +0000)
committerKrinkle <krinklemail@gmail.com>
Wed, 18 May 2016 18:54:50 +0000 (18:54 +0000)
This reverts commit b287ec2cc649a96bb19c893c46f88734c6392204.

Change-Id: I59e996dfe627e8a978ed849a8e82ad4e0b165d7f

includes/actions/Action.php
tests/phpunit/includes/actions/ActionTest.php

index 4208b3b..839d7b2 100644 (file)
@@ -147,7 +147,7 @@ abstract class Action {
                // Trying to get a WikiPage for NS_SPECIAL etc. will result
                // in WikiPage::factory throwing "Invalid or virtual namespace -1 given."
                // For SpecialPages et al, default to action=view.
-               if ( $actionName === '' || !$context->canUseWikiPage() ) {
+               if ( !$context->canUseWikiPage() ) {
                        return 'view';
                }
 
index 75c5b50..4a30292 100644 (file)
@@ -56,6 +56,8 @@ class ActionTest extends MediaWikiTestCase {
                        // Null and non-existing values
                        [ 'null', null ],
                        [ 'undeclared', null ],
+                       [ '', null ],
+                       [ false, null ],
                ];
        }
 
@@ -135,39 +137,22 @@ class ActionTest extends MediaWikiTestCase {
                $this->assertType( $expected ?: 'null', $action );
        }
 
-       public function emptyActionProvider() {
-               return [
-                       [ null ],
-                       [ false ],
-                       [ '' ],
-               ];
-       }
-
-       /**
-        * @dataProvider emptyActionProvider
-        */
-       public function testEmptyAction_doesNotExist( $requestedAction ) {
-               $exists = Action::exists( $requestedAction );
+       public function testNull_doesNotExist() {
+               $exists = Action::exists( null );
 
                $this->assertFalse( $exists );
        }
 
-       /**
-        * @dataProvider emptyActionProvider
-        */
-       public function testEmptyAction_defaultsToView( $requestedAction ) {
-               $context = $this->getContext( $requestedAction );
+       public function testNull_defaultsToView() {
+               $context = $this->getContext( null );
                $actionName = Action::getActionName( $context );
 
                $this->assertEquals( 'view', $actionName );
        }
 
-       /**
-        * @dataProvider emptyActionProvider
-        */
-       public function testEmptyAction_canNotBeInstantiated( $requestedAction ) {
+       public function testNull_canNotBeInstantiated() {
                $page = $this->getPage();
-               $action = Action::factory( $requestedAction, $page );
+               $action = Action::factory( null, $page );
 
                $this->assertNull( $action );
        }