本文整理匯總了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();
}