当前位置: 首页>>代码示例>>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;未经允许,请勿转载。