/**
* @covers Action
*
- * @licence GNU GPL v2+
* @author Thiemo Mättig
*
* @group Action
// Null and non-existing values
array( 'null', null ),
array( 'undeclared', null ),
+ array( '', null ),
+ array( false, null ),
);
}
$this->assertEquals( 'revisiondelete', $actionName );
}
+ public function testGetActionName_whenCanNotUseWikiPage_defaultsToView() {
+ $request = new FauxRequest( array( 'action' => 'edit' ) );
+ $context = new DerivativeContext( RequestContext::getMain() );
+ $context->setRequest( $request );
+ $actionName = Action::getActionName( $context );
+
+ $this->assertEquals( 'view', $actionName );
+ }
+
/**
* @dataProvider actionProvider
* @param string $requestedAction
$this->assertType( $expected ?: 'null', $action );
}
- public function emptyActionProvider() {
- return array(
- array( null ),
- array( false ),
- array( '' ),
- );
- }
-
- /**
- * @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() {
+ public function testNull_defaultsToView() {
$context = $this->getContext( null );
$actionName = Action::getActionName( $context );
$this->assertEquals( 'view', $actionName );
}
- /**
- * @dataProvider emptyActionProvider
- */
- public function testEmptyAction_canNotBeInstantiated() {
+ public function testNull_canNotBeInstantiated() {
$page = $this->getPage();
$action = Action::factory( null, $page );