From: Krinkle Date: Wed, 18 May 2016 18:54:50 +0000 (+0000) Subject: Revert "Make an empty "?action=" parameter default to "view"" X-Git-Tag: 1.31.0-rc.0~6926^2 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=caf87b48938fc23c1a95936d692c82f73e3d21e9;p=lhc%2Fweb%2Fwiklou.git Revert "Make an empty "?action=" parameter default to "view"" This reverts commit b287ec2cc649a96bb19c893c46f88734c6392204. Change-Id: I59e996dfe627e8a978ed849a8e82ad4e0b165d7f --- diff --git a/includes/actions/Action.php b/includes/actions/Action.php index 4208b3b49e..839d7b23e7 100644 --- a/includes/actions/Action.php +++ b/includes/actions/Action.php @@ -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'; } diff --git a/tests/phpunit/includes/actions/ActionTest.php b/tests/phpunit/includes/actions/ActionTest.php index 75c5b500c1..4a302920e1 100644 --- a/tests/phpunit/includes/actions/ActionTest.php +++ b/tests/phpunit/includes/actions/ActionTest.php @@ -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 ); }