当前位置: 首页>>代码示例>>PHP>>正文


PHP TreeRouteStack::factory方法代码示例

本文整理汇总了PHP中Zend\Mvc\Router\Http\TreeRouteStack::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP TreeRouteStack::factory方法的具体用法?PHP TreeRouteStack::factory怎么用?PHP TreeRouteStack::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Mvc\Router\Http\TreeRouteStack的用法示例。


在下文中一共展示了TreeRouteStack::factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 public function setUp()
 {
     $this->request = new Request();
     $this->helper = new QueryUrl($this->request);
     $this->router = TreeRouteStack::factory(['routes' => ['route-name' => new Literal('/foo/bar')]]);
     $this->helper->setRouter($this->router);
 }
开发者ID:jkhaled,项目名称:LearnZF2,代码行数:7,代码来源:QueryUrlTest.php

示例2: setUp

 protected function setUp()
 {
     //check if child class implements the correct interface
     if (!$this instanceof TestCaseAdapterInterface) {
         throw new \Exception(__CLASS__ . " : Line " . __LINE__ . " : Test Case could not executed. It must implement FrontCore\\TestsConfig\\TestCaseAdapterInterface", 500);
     }
     //end if
     //check if bootstrap instance has been set
     if (!$this->bootstrap) {
         throw new \Exception(__CLASS__ . " : Line " . __LINE__ . " : Test Case could not executed. Bootstrap instance is not set", 500);
     }
     //end if
     $this->serviceManager = $this->bootstrap->getServiceManager();
     //$this->controller = new IndexController();
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'index'));
     $this->event = new MvcEvent();
     $config = $this->serviceManager->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     //$this->controller->setEvent($this->event);
     //$this->controller->setServiceLocator($serviceManager);
     //create logged in user
     $arr_user_data = array("id" => "1", "uname" => "user", "pword" => "5f4dcc3b5aa765d61d8327deb882cf99", "api_key" => "2c0f-828c-b184-f33f-2944-ad2d-f51c-e17a-7a13-ef2a-f581-8e2b", "phpunit" => TRUE);
     $objUserSession = $this->serviceManager->get("FrontUserLogin\\Models\\FrontUserSession")->createUserSession((object) $arr_user_data);
 }
开发者ID:BanterMediaSA,项目名称:majestic3-open-source,代码行数:28,代码来源:TestCaseAdapter.php

示例3: setUp

 public function setUp()
 {
     $basePath = __DIR__ . '/../../../../../';
     $this->setApplicationConfig(include $basePath . 'config/application.config.php');
     $serviceManager = Bootstrap::getServiceManager();
     $this->controller = new \Galaxy\Controller\IndexController();
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'index'));
     $this->event = new MvcEvent();
     $config = $serviceManager->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($serviceManager);
     $mockAuth = $this->getMock('ZfcUser\\Entity\\UserInterface');
     $ZfcUserMock = $this->getMock('User\\Entity\\User');
     $ZfcUserMock->expects($this->any())->method('getId')->will($this->returnValue('3'));
     $authMock = $this->getMock('ZfcUser\\Controller\\Plugin\\ZfcUserAuthentication');
     $authMock->expects($this->any())->method('hasIdentity')->will($this->returnValue(true));
     $authMock->expects($this->any())->method('getIdentity')->will($this->returnValue($ZfcUserMock));
     $this->controller->getPluginManager()->setService('zfcUserAuthentication', $authMock);
     parent::setUp();
 }
开发者ID:nouron,项目名称:nouron,代码行数:25,代码来源:IndexControllerTest.php

示例4: setUpController

 protected function setUpController(\Zend\Mvc\Controller\AbstractActionController $controller)
 {
     $config = (include 'config/application.config.php');
     $serviceManager = new ServiceManager(new ServiceManagerConfig());
     $serviceManager->setService('ApplicationConfig', $config);
     $serviceManager->get('ModuleManager')->loadModules();
     $serviceManager->setAllowOverride(true);
     $this->controller = $controller;
     $this->request = new Request();
     $this->response = new Response();
     $this->routeMatch = new RouteMatch(array('controller' => 'index'));
     $this->event = new MvcEvent();
     $this->event->setRequest($this->request)->setResponse($this->response);
     $config = $serviceManager->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($serviceManager);
     $this->setupForwardPlugin();
     $this->setupParamsPlugin();
     $this->setupFormPlugin();
     $this->setupGridControllerPlugin();
     $this->setupControllerFilePlugin();
 }
开发者ID:noikiy,项目名称:tools,代码行数:26,代码来源:ControllerTestCase.php

示例5: setUp

 public function setUp()
 {
     $config = (include __DIR__ . '/../../../config/module.config.php');
     $renderer = new PhpRenderer();
     $renderer->setResolver(new TemplateMapResolver($config['view_manager']['template_map']));
     $router = TreeRouteStack::factory($config['router']);
     $this->helper = new QrCodeHelper($renderer, $router, new QrCodeServiceMock('foobar'));
 }
开发者ID:acelaya,项目名称:zf2-acqrcode,代码行数:8,代码来源:QrCodeHelperTest.php

示例6: getServiceConfig

 /**
  * {@inheritDoc}
  */
 public function getServiceConfig()
 {
     return array('factories' => array('Application' => function (ServiceLocatorInterface $sl) {
         return new App($sl->get('Config'), $sl);
     }, 'Router' => function () {
         return HttpRouter::factory(array());
     }, 'HttpRouter' => function (ServiceLocatorInterface $sl) {
         return $sl->get('Router');
     }));
 }
开发者ID:binarykitten,项目名称:zeffmu,代码行数:13,代码来源:Module.php

示例7: getController

 public function getController($controllerClass, $controllerName, $action, $params = [])
 {
     $config = $this->getConfig();
     $controller = $this->getServiceManager()->get('ControllerLoader')->get($controllerClass);
     $event = new MvcEvent();
     $routerConfig = isset($config['router']) ? $config['router'] : [];
     $router = TreeRouteStack::factory($routerConfig);
     $event->setRouter($router);
     $event->setRouteMatch(new RouteMatch(['controller' => $controllerName, 'action' => $action] + $params));
     $controller->setEvent($event);
     return $controller;
 }
开发者ID:argentinaluiz,项目名称:js_zf2_library,代码行数:12,代码来源:JSTestControllerCase.php

示例8: setUp

 protected function setUp()
 {
     $this->controller = new ConfigurationRestController();
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'rest_configuration'));
     $this->event = new MvcEvent();
     $config = Bootstrap::getServiceManager()->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator(Bootstrap::getServiceManager());
 }
开发者ID:dsi-agpt,项目名称:minibus,代码行数:14,代码来源:ConfigurationRestControllerTest.php

示例9: createServiceLocator

 /**
  * @return ServiceLocatorInterface
  */
 private function createServiceLocator(MvcEvent $e = null)
 {
     $sm = new ServiceManager();
     $sm->setService('Request', new Request());
     $sm->setService('Response', new Response());
     $sm->setService('EventManager', new EventManager());
     $sm->setService('Router', TreeRouteStack::factory(['routes' => []]));
     $e = $e ?: new MvcEvent();
     $app = $this->getMock('Zend\\Mvc\\Application', [], [[], $sm]);
     $app->expects($this->any())->method('getMvcEvent')->willReturn($e);
     $sm->setService('Application', $app);
     $helperManager = new HelperPluginManager();
     $helperManager->setServiceLocator($sm);
     return $helperManager;
 }
开发者ID:jkhaled,项目名称:LearnZF2,代码行数:18,代码来源:QueryUrlFactoryTest.php

示例10: createServiceLocator

 /**
  * @return ServiceLocatorInterface
  */
 private function createServiceLocator(MvcEvent $e = null)
 {
     $sm = new ServiceManager();
     $sm->setService('Request', new Request());
     $sm->setService('Response', new Response());
     $sm->setService('EventManager', new EventManager());
     $sm->setService('Router', TreeRouteStack::factory(['routes' => []]));
     $e = $e ?: new MvcEvent();
     $app = $this->prophesize('Zend\\Mvc\\Application');
     $app->getMvcEvent()->willReturn($e);
     $sm->setService('Application', $app->reveal());
     $helperManager = new HelperPluginManager();
     $helperManager->setServiceLocator($sm);
     return $helperManager;
 }
开发者ID:shitikovkirill,项目名称:LearnZF2,代码行数:18,代码来源:QueryUrlFactoryTest.php

示例11: setUp

 protected function setUp()
 {
     $serviceManager = $this->getServiceManager();
     $this->controller = new IndexController();
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'index'));
     $this->event = new MvcEvent();
     $config = $serviceManager->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($serviceManager);
 }
开发者ID:uthando-cms,项目名称:uthando,代码行数:15,代码来源:IndexControllerTest.php

示例12: setUp

 protected function setUp()
 {
     $serviceManagerGrabber = new ServiceManagerGrabber();
     $this->serviceManager = $serviceManagerGrabber->getServiceManager();
     $this->serviceManager->setAllowOverride(true);
     $this->serviceManager->setService('doctrine.entitymanager.orm_default', $this->getEntityManagerMock());
     $config = $this->serviceManager->get('Config');
     $this->request = new PhpEnviromentRequest();
     $this->router = HttpRouter::factory(isset($config['router']) ? $config['router'] : array());
     $this->routeMatch = new RouteMatch(array('controller' => 'index'));
     $this->routeMatch->setParam('lang', 'it');
     $this->event = new MvcEvent();
     $this->event->setRouter($this->router);
     $this->event->setRouteMatch($this->routeMatch);
 }
开发者ID:usban,项目名称:entilocali,代码行数:15,代码来源:TestSuite.php

示例13: setUp

 protected function setUp()
 {
     $this->serviceManager = ServiceManagerFactory::getServiceManager();
     $this->controller = new IndexController();
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(['controller' => IndexController::class]);
     $this->event = new MvcEvent();
     $config = $this->serviceManager->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : [];
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($this->serviceManager);
 }
开发者ID:jonathangreco,项目名称:ZendSkeletonHeavy,代码行数:15,代码来源:IndexControllerTest.php

示例14: setUp

 public function setUp()
 {
     parent::setUp();
     $this->_serviceManager = \Bootstrap::getServiceManager();
     $this->controller = new GridController();
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array());
     $this->event = new MvcEvent();
     $config = $this->_serviceManager->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($this->_serviceManager);
 }
开发者ID:kdrezo,项目名称:zf2-datagrid,代码行数:16,代码来源:BaseTestClass.php

示例15: setUp

 public function setUp()
 {
     parent::setUp();
     $this->controller = new $this->controllerStringName();
     $this->request = $this->controller->getRequest();
     $this->response = $this->controller->getResponse();
     $this->routeMatch = new RouteMatch(array('controller' => 'index'));
     $this->event = new MvcEvent();
     $config = $this->getService('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($this->serviceManager);
 }
开发者ID:michelcandido,项目名称:zf2-doctrine-tests,代码行数:16,代码来源:CoreControllerTestCase.php


注:本文中的Zend\Mvc\Router\Http\TreeRouteStack::factory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。