當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。