// 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';
}
// Null and non-existing values
[ 'null', null ],
[ 'undeclared', null ],
+ [ '', null ],
+ [ false, null ],
];
}
$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 );
}