コード例 #1
0
 /**
  * @covers Controller::hasAction
  */
 public function testHasAction()
 {
     $controller = new ControllerTest_HasAction();
     $unsecuredController = new ControllerTest_HasAction_Unsecured();
     $securedController = new ControllerTest_AccessSecuredController();
     $this->assertFalse($controller->hasAction('1'), 'Numeric actions do not slip through.');
     //$this->assertFalse(
     //	$controller->hasAction('lowercase_permission'),
     //	'Lowercase permission does not slip through.'
     //);
     $this->assertFalse($controller->hasAction('undefined'), 'undefined actions do not exist');
     $this->assertTrue($controller->hasAction('allowed_action'), 'allowed actions are recognised');
     $this->assertTrue($controller->hasAction('template_action'), 'action-specific templates are recognised');
     $this->assertTrue($unsecuredController->hasAction('defined_action'), 'Without an allowed_actions, any defined methods are recognised as actions');
     $this->assertTrue($securedController->hasAction('adminonly'), 'Method is generally visible even if its denied via allowed_actions');
     $this->assertFalse($securedController->hasAction('protectedmethod'), 'Method is not visible when protected, even if its defined in allowed_actions');
     $this->assertTrue($securedController->hasAction('extensionmethod1'), 'Method is visible when defined on an extension and part of allowed_actions');
     $this->assertFalse($securedController->hasAction('internalextensionmethod'), 'Method is not visible when defined on an extension, but not part of allowed_actions');
     $this->assertFalse($securedController->hasAction('protectedextensionmethod'), 'Method is not visible when defined on an extension, part of allowed_actions, ' . 'but with protected visibility');
 }
コード例 #2
0
ファイル: ControllerTest.php プロジェクト: normann/sapphire
 /**
  * @covers Controller::hasAction
  */
 public function testHasAction()
 {
     $controller = new ControllerTest_HasAction();
     $this->assertFalse($controller->hasAction('1'), 'Numeric actions do not slip through.');
     //$this->assertFalse($controller->hasAction('lowercase_permission'),
     //'Lowercase permission does not slip through.');
     $this->assertFalse($controller->hasAction('undefined'), 'undefined actions do not exist');
     $this->assertTrue($controller->hasAction('allowed_action'), 'allowed actions are recognised');
     $this->assertTrue($controller->hasAction('template_action'), 'action-specific templates are recognised');
     $unsecured = new ControllerTest_HasAction_Unsecured();
     $this->assertTrue($unsecured->hasAction('defined_action'), 'Without an allowed_actions, any defined methods are recognised as actions');
 }