Make an empty "?action=" parameter default to "view"
[lhc/web/wiklou.git] / tests / phpunit / includes / actions / ActionTest.php
index cc6fb11..429de4e 100644 (file)
@@ -57,8 +57,6 @@ class ActionTest extends MediaWikiTestCase {
                        // Null and non-existing values
                        array( 'null', null ),
                        array( 'undeclared', null ),
-                       array( '', null ),
-                       array( false, null ),
                );
        }
 
@@ -129,20 +127,37 @@ class ActionTest extends MediaWikiTestCase {
                $this->assertType( $expected ?: 'null', $action );
        }
 
-       public function testNull_doesNotExist() {
-               $exists = Action::exists( null );
+       public function emptyActionProvider() {
+               return array(
+                       array( null ),
+                       array( false ),
+                       array( '' ),
+               );
+       }
+
+       /**
+        * @dataProvider emptyActionProvider
+        */
+       public function testEmptyAction_doesNotExist( $requestedAction ) {
+               $exists = Action::exists( $requestedAction );
 
                $this->assertFalse( $exists );
        }
 
-       public function testNull_defaultsToView() {
+       /**
+        * @dataProvider emptyActionProvider
+        */
+       public function testEmptyAction_defaultsToView() {
                $context = $this->getContext( null );
                $actionName = Action::getActionName( $context );
 
                $this->assertEquals( 'view', $actionName );
        }
 
-       public function testNull_canNotBeInstantiated() {
+       /**
+        * @dataProvider emptyActionProvider
+        */
+       public function testEmptyAction_canNotBeInstantiated() {
                $page = $this->getPage();
                $action = Action::factory( null, $page );