本文整理汇总了PHP中Service::setCurrentAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::setCurrentAction方法的具体用法?PHP Service::setCurrentAction怎么用?PHP Service::setCurrentAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Service
的用法示例。
在下文中一共展示了Service::setCurrentAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetCurrentAction
function testSetCurrentAction()
{
$service = new Service('test');
$service->setCurrentAction($action = 'test action');
$this->assertEqual($service->getCurrentAction(),
$action);
}
示例2: run
function run(&$filter_chain, &$request, &$response)
{
$toolkit =& Limb::toolkit();
if (!($service =& $toolkit->getService())) {
$filter_chain->next();
return;
}
$service_name = $service->getName();
$action = $service->getCurrentAction();
$uri =& $request->getUri();
$path =& $uri->getPath();
$acl_toolkit =& Limb::toolkit('SimpleACL');
$authorizer =& $acl_toolkit->getAuthorizer();
if ($authorizer->canDo($action, $path, $service_name)) {
$filter_chain->next();
return;
}
$new_service = new Service('403');
$new_service->setCurrentAction($new_service->getDefaultAction());
$toolkit->setService($new_service);
$filter_chain->next();
}
示例3: testRunAccessDenied
function testRunAccessDenied()
{
RegisterTestingIni('403.service.ini', '
default_action = display
[display]
props');
$toolkit =& Limb::toolkit();
$request =& $toolkit->getRequest();
$uri =& $request->getUri();
$uri->setPath($path = 'whatever');
$service = new Service($service_name = 'TestService');
$service->setCurrentAction($action = 'some_action');
$this->authorizer->expectOnce('canDo', array($action, $path, $service_name));
$this->authorizer->setReturnValue('canDo', false);
$filter = new SimpleACLAccessFilter();
$fc = new MockFilterChain($this);
$fc->expectOnce('next');
$toolkit->setService($service);
$filter->run($fc, $request, $response);
$new_service =& $toolkit->getService();
$this->assertEqual($new_service->getName(), '403');
$this->assertEqual($new_service->getCurrentAction(), 'display');
$fc->tally();
}