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


PHP MvcEvent::setRouteMatch方法代码示例

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


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

示例1: testAppNameNotSetWhenMissingInConfig

 public function testAppNameNotSetWhenMissingInConfig()
 {
     $this->moduleOptions->setApplicationName('');
     $this->client->expects($this->never())->method('setAppName');
     $routeMatch = class_exists(RouteMatch::class) ? new RouteMatch([]) : new RouteMatchV2([]);
     $this->event->setRouteMatch($routeMatch);
     $this->listener->onRequest($this->event);
 }
开发者ID:neeckeloo,项目名称:newrelic,代码行数:8,代码来源:RequestListenerTest.php

示例2: init

 public function init($controllerName, $actionName = 'index')
 {
     $this->routeMatch = new RouteMatch(['controller' => $controllerName, 'action' => $actionName]);
     $this->event = new MvcEvent();
     $this->event->setRouteMatch($this->routeMatch);
     $this->event->setRouter((new RouterFactory())->createService(Bootstrap::getServiceManager()));
     $this->prepareAuthenticateMock();
 }
开发者ID:omusico,项目名称:zf2-demo,代码行数:8,代码来源:AbstractControllerTestCase.php

示例3: testAppNameNotSetWhenMissingInConfig

 public function testAppNameNotSetWhenMissingInConfig()
 {
     $this->moduleOptions->setApplicationName("");
     $this->client->expects($this->never())->method('setAppName');
     $routeMatch = new \Zend\Mvc\Router\RouteMatch(array());
     $this->event->setRouteMatch($routeMatch);
     $this->listener->onRequest($this->event);
 }
开发者ID:simplicity-ag,项目名称:NewRelic,代码行数:8,代码来源:RequestListenerTest.php

示例4: getEvent

 /**
  * Retrieve the composed event
  *
  * @return Event
  */
 public function getEvent()
 {
     if (!isset($this->event)) {
         $this->setEvent(new MvcEvent());
         $this->event->setRouteMatch(new RouteMatch($this->routeParams));
     }
     return $this->event;
 }
开发者ID:acelaya,项目名称:zf2-acqrcode,代码行数:13,代码来源:ControllerMock.php

示例5: setup

 public function setup()
 {
     parent::setup();
     $this->controller = $this->serviceManager->get($this->controllerFQDN);
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('router' => array('routes' => array($this->controllerRoute => $this->routes[$this->controllerRoute]))));
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($this->serviceManager);
 }
开发者ID:jkhaled,项目名称:ZendSkeletonApplication-1,代码行数:10,代码来源:ControllerTestCase.php

示例6: init

 public function init($controllerName, $actionName = 'index', $lang = 'en')
 {
     $this->routeMatch = new RouteMatch(array('controller' => $controllerName, 'action' => $actionName, 'lang' => $lang));
     $this->event = new MvcEvent();
     $this->event->setRouteMatch($this->routeMatch);
     /** @var SimpleRouteStack $router */
     $routerFactory = new RouterFactory();
     $router = $routerFactory->createService(clone Bootstrap::getServiceManager());
     $router->setDefaultParam('lang', $lang);
     $this->event->setRouter($router);
 }
开发者ID:webpants,项目名称:YAWIK,代码行数:11,代码来源:AbstractControllerTestCase.php

示例7: setUp

 /**
  * Setup
  */
 public function setUp()
 {
     $this->setFormManager(new \StrokerForm\FormManager());
     $this->controller = new AjaxController($this->getFormManager());
     $this->request = new Request();
     $this->response = new Response();
     $controllerName = strtolower(str_replace('Controller', '', get_class($this->controller)));
     $this->routeMatch = new RouteMatch(array('controller' => $controllerName));
     $this->event = new MvcEvent();
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
 }
开发者ID:rettal,项目名称:zf2-form,代码行数:15,代码来源:AjaxControllerTest.php

示例8: setUp

 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->setApplicationConfig(include __DIR__ . '/../../../../../../tests/config/application.config.php');
     parent::setUp();
     $this->controller = new IdeaController();
     $this->request = new Request();
     $this->response = null;
     $this->routeMatch = new RouteMatch(['controller' => 'project-idea']);
     $this->event = new MvcEvent();
     $router = new SimpleRouteStack();
     $router->addRoute('idea/idea', ['type' => 'Zend\\Mvc\\Router\\Http\\Literal', 'options' => ['route' => "project/idea.html"]]);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     //Get the serviceLocation and inject it into the controller
     $serviceLocator = $this->getApplicationServiceLocator();
     $this->controller->setServiceLocator($serviceLocator);
     $formService = $serviceLocator->get(FormService::class);
     $this->controller->setFormService($formService);
     $ideaServiceMock = $this->getMockBuilder('Project\\Service\\IdeaService')->disableOriginalConstructor()->getMock();
     $newEntityResult = new Idea();
     $newEntityResult->setId(1);
     $ideaServiceMock->expects($this->any())->method('newEntity')->will($this->returnValue($newEntityResult));
     $ideaServiceMock->expects($this->any())->method('findAll')->will($this->returnValue([]));
     $this->controller->setIdeaService($serviceLocator->get(IdeaService::class));
     $serviceManager = $this->getApplicationServiceLocator();
     $serviceManager->setAllowOverride(true);
     $serviceManager->setService(IdeaService::class, $ideaServiceMock);
     $authorizeServiceMock = $this->getMockBuilder('BjyAuthorize\\View\\Helper\\IsAllowed')->disableOriginalConstructor()->getMock();
     $authorizeServiceMock->expects($this->any())->method('__invoke')->will($this->returnValue(true));
     $serviceManager = $this->getApplicationServiceLocator()->get('viewhelpermanager');
     $serviceManager->setAllowOverride(true);
     $serviceManager->setService('isAllowed', $authorizeServiceMock);
     $this->controller->getPluginManager()->setFactory('zfcUserAuthentication', function ($sm) {
         $serviceLocator = $sm->getController()->getServiceLocator();
         $authService = new AuthenticationService();
         $nonPersistent = new NonPersistent();
         /**
          * Store a reference if the contact in the session
          */
         $entityManager = $serviceLocator->get('doctrine.entitymanager.orm_default');
         $contact = $entityManager->getReference("Contact\\Entity\\Contact", 1);
         $nonPersistent->write($contact);
         $authService->setStorage($nonPersistent);
         $authAdapter = $serviceLocator->get('ZfcUser\\Authentication\\Adapter\\AdapterChain');
         $controllerPlugin = new \ZfcUser\Controller\Plugin\ZfcUserAuthentication();
         $controllerPlugin->setAuthService($authService);
         $controllerPlugin->setAuthAdapter($authAdapter);
         return $controllerPlugin;
     });
 }
开发者ID:debranova,项目名称:project,代码行数:54,代码来源:IdeaControllerTest.php

示例9: setUp

 protected function setUp()
 {
     $this->console = $this->getMockOfConsole();
     $this->controller = new IndexController();
     $this->event = new MvcEvent();
     $this->request = new Request();
     $this->response = new Response();
     $this->routeMatch = new RouteMatch(array('controller' => 'index'));
     $this->controller->setConsole($this->console);
     $this->controller->setEvent($this->event);
     $this->event->setRequest($this->request);
     $this->event->setResponse($this->response);
     $this->event->setRouteMatch($this->routeMatch);
 }
开发者ID:bazzline,项目名称:zf_cli_generator,代码行数:14,代码来源:IndexControllerTest.php

示例10: setup

 /**
  * Faz o setup dos testes. Executado antes de cada teste
  * @return void
  */
 public function setup()
 {
     parent::setup();
     //instancia o controller
     $this->controller = new $this->controllerFQDN();
     //cria um novo request
     $this->request = new Request();
     //cria o routeMatch baseado nas configurações do módulo/aplicação
     $this->routeMatch = new RouteMatch(array('router' => array('routes' => array($this->controllerRoute => $this->routes[$this->controllerRoute]))));
     //configura a rota para o evento de MVC corrente
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($this->serviceManager);
 }
开发者ID:cepheros,项目名称:zf2-doctrine,代码行数:18,代码来源:ControllerTest.php

示例11: setUp

 protected function setUp()
 {
     $serviceManager = Bootstrap::getServiceManager();
     $this->controller = new HotelController();
     $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:breaktherules,项目名称:rest-hotel-client,代码行数:15,代码来源:HotelControllerTest.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

 public function setUp()
 {
     $this->eventManager = new EventManager();
     $this->event = new MvcEvent();
     $this->object = new TestObject();
     $this->serviceLocator = new ServiceManager();
     $this->docs = $this->getMockBuilder('WidRestApiDocumentator\\Service\\Docs')->disableOriginalConstructor()->getMock();
     $this->serviceLocator->setService('WidRestApiDocumentator\\Service\\Docs', $this->docs);
     $this->routeMatch = new RouteMatch(array('controller' => 'WidRestApiDocumentator\\Controller\\Docs'));
     $this->event->setRouteMatch($this->routeMatch);
     $this->request = new Request();
     $this->response = new Response();
     $this->object->setServiceLocator($this->serviceLocator);
     $this->object->setEventManager($this->eventManager);
     $this->object->setEvent($this->event);
 }
开发者ID:widmogrod,项目名称:zf2-rest-api-documentator,代码行数:16,代码来源:DocsController.php

示例14: setUp

 /**
  * Setup for tests
  *
  * @return null
  */
 public function setUp()
 {
     $this->mockPageRepo = $this->getMockBuilder('\\Rcm\\Repository\\Page')->disableOriginalConstructor()->getMock();
     $this->mockPageRepo->expects($this->any())->method('getPageByName')->will($this->returnCallback([$this, 'pageRepoMockCallback']));
     $mockLayoutManager = $this->getMockBuilder('\\Rcm\\Service\\LayoutManager')->disableOriginalConstructor()->getMock();
     $mockLayoutManager->expects($this->any())->method('getSiteLayout')->will($this->returnCallback([$this, 'layoutManagerMockCallback']));
     $this->mockUserServicePlugin = $this->getMockBuilder('\\Rcm\\Controller\\Plugin\\RcmIsAllowed')->disableOriginalConstructor()->getMock();
     $this->mockIsPageAllowed = $this->getMockBuilder('\\Rcm\\Controller\\Plugin\\RcmIsPageAllowed')->disableOriginalConstructor()->getMock();
     $this->mockShouldShowRevisions = $this->getMockBuilder('\\Rcm\\Controller\\Plugin\\ShouldShowRevisions')->disableOriginalConstructor()->getMock();
     $this->mockRedirectToPage = $this->getMockBuilder('\\Rcm\\Controller\\Plugin\\RedirectToPage')->disableOriginalConstructor()->getMock();
     $this->mockIsSiteAdmin = $this->getMockBuilder('\\Rcm\\Controller\\Plugin\\IsSiteAdmin')->disableOriginalConstructor()->getMock();
     $this->currentSite = new Site();
     $this->currentSite->setSiteId(1);
     $this->currentSite->setNotFoundPage('not-found');
     $config = ['contentManager' => ['type' => 'Zend\\Mvc\\Router\\Http\\Segment', 'options' => ['route' => '/rcm[/:page][/:revision]', 'defaults' => ['controller' => 'Rcm\\Controller\\IndexController', 'action' => 'index']]], 'contentManagerWithPageType' => ['type' => 'Zend\\Mvc\\Router\\Http\\Segment', 'options' => ['route' => '/rcm/:pageType/:page[/:revision]', 'constraints' => ['pageType' => '[a-z]'], 'defaults' => ['controller' => 'Rcm\\Controller\\IndexController', 'action' => 'index']]]];
     /** @var \Rcm\Service\LayoutManager $mockLayoutManager */
     $this->controller = new IndexController($mockLayoutManager, $this->currentSite, $this->mockPageRepo);
     $this->controller->getPluginManager()->setService('rcmIsAllowed', $this->mockUserServicePlugin)->setService('shouldShowRevisions', $this->mockShouldShowRevisions)->setService('redirectToPage', $this->mockRedirectToPage)->setService('rcmIsSiteAdmin', $this->mockIsSiteAdmin)->setService('rcmIsPageAllowed', $this->mockIsPageAllowed);
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(['controller' => 'index']);
     $this->event = new MvcEvent();
     $routerConfig = $config;
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
 }
开发者ID:reliv,项目名称:rcm,代码行数:32,代码来源:IndexControllerTest.php

示例15: setUp

 public function setUp()
 {
     // Used by \KJSencha\Service\ApiFactory::createService
     \Zend\Console\Console::overrideIsConsole(false);
     $sl = ServiceManagerFactory::getServiceManager();
     /* @var $manager DirectManager */
     $manager = $sl->get('kjsencha.direct.manager');
     /* @var $apiFactory \KJSencha\Direct\Remoting\Api\Api */
     $api = $sl->get('kjsencha.api');
     $this->controller = new DirectController($manager, $api);
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'kjsencha_direct'));
     $this->event = new MvcEvent();
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
 }
开发者ID:shraddhanegi,项目名称:KJSencha,代码行数:16,代码来源:DirectControllerTest.php


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