當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Service::setCurrentAction方法代碼示例

本文整理匯總了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);
  }
開發者ID:BackupTheBerlios,項目名稱:limb-svn,代碼行數:9,代碼來源:ServiceTest.class.php

示例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();
 }
開發者ID:BackupTheBerlios,項目名稱:limb-svn,代碼行數:22,代碼來源:SimpleACLAccessFilter.class.php

示例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();
 }
開發者ID:BackupTheBerlios,項目名稱:limb-svn,代碼行數:24,代碼來源:SimpleACLAccessFilterTest.class.php


注:本文中的Service::setCurrentAction方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。