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


PHP RouteMatch::setParam方法代码示例

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


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

示例1: testNoRolesAllowed

 public function testNoRolesAllowed()
 {
     $this->routeMatch->setParam('action', 'noRoles');
     $listener = new Authorized();
     $listener->onDispach($this->event);
     $this->assertNull($this->event->getParam('exception'));
 }
开发者ID:gontero,项目名称:gontero-acl,代码行数:7,代码来源:AuthorizedListenerTest.php

示例2: resolveController

 public static function resolveController(RouteMatch $routeMatch)
 {
     if (($extension = $routeMatch->getParam('extension')) && ($manifestName = $routeMatch->getParam('manifestName'))) {
         if ($endpoint = $routeMatch->getParam('endpoint')) {
             $routeMatch->setParam('controller', implode('.', [$extension, $manifestName, $endpoint]));
         } else {
             $routeMatch->setParam('controller', implode('.', [$extension, $manifestName]));
         }
     }
 }
开发者ID:superdweebie,项目名称:doctrine-extensions-module,代码行数:10,代码来源:RouteListener.php

示例3: testResizeActionFileNotFound

 public function testResizeActionFileNotFound()
 {
     $this->routeMatch->setParam('action', 'resize');
     $this->routeMatch->setParam('file', 'img/test/fileNotFound');
     $this->routeMatch->setParam('extension', 'jpg');
     $this->routeMatch->setParam('command', 'thumb,80,40');
     $result = $this->controller->dispatch($this->request);
     $response = $this->controller->getResponse();
     $this->assertEquals(404, $response->getStatusCode());
 }
开发者ID:tck,项目名称:zf2-imageresizer,代码行数:10,代码来源:IndexControllerTest.php

示例4: resolveController

 public static function resolveController(RouteMatch $routeMatch)
 {
     if ($routeMatch->getMatchedRouteName() != 'rest') {
         return;
     }
     if ($endpoint = $routeMatch->getParam('endpoint')) {
         $routeMatch->setParam('controller', 'shard.rest.' . $endpoint);
     } else {
         $routeMatch->setParam('controller', 'shard.rest');
     }
 }
开发者ID:zoopcommerce,项目名称:shard-module,代码行数:11,代码来源:RouteListener.php

示例5: 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

示例6: testCanSearchProjects

 /**
  * @covers \Project\Controller\ProjectController::searchAction
  */
 public function testCanSearchProjects()
 {
     $this->routeMatch->setParam('action', 'search');
     $queryParams = new Parameters(['search_item' => 'test', 'max_rows' => 12]);
     $this->request->setQuery($queryParams);
     $this->controller->dispatch($this->request, $this->response);
     $this->assertEquals(200, $this->controller->getResponse()->getStatusCode());
 }
开发者ID:debranova,项目名称:project,代码行数:11,代码来源:ProjectControllerTest.php

示例7: testUpdateWrongIdeaDescriptionGives404

 /**
  * @covers \Project\Controller\IdeaController::updateDescriptionAction
  */
 public function testUpdateWrongIdeaDescriptionGives404()
 {
     $this->routeMatch->setParam('action', 'update-description');
     $queryParams = new Parameters(['id' => 'description-0', 'value' => 'This is the new description']);
     $this->request->setPost($queryParams);
     $this->controller->dispatch($this->request, $this->response);
     $this->assertEquals(404, $this->controller->getResponse()->getStatusCode());
 }
开发者ID:debranova,项目名称:project,代码行数:11,代码来源:IdeaControllerTest.php

示例8: testDeleteCategory

 /**
  * @depends testGetCategory
  * @param int $id
  */
 public function testDeleteCategory($id)
 {
     $this->getRequest()->setMethod(Request::METHOD_DELETE);
     $this->routeMatch->setParam('id', $id);
     $jsonModel = $this->dispatchRequest();
     $this->assertEquals(200, $this->controller->getResponse()->getStatusCode());
     $this->assertEquals('success', $jsonModel->getVariable('message')['type']);
 }
开发者ID:veniva,项目名称:zcms,代码行数:12,代码来源:CategoryControllerTest.php

示例9: testDeleteListing

 /**
  * @depends testGetListing
  *
  * @param int $id
  */
 public function testDeleteListing($id)
 {
     $this->getRequest()->setMethod(Request::METHOD_POST);
     $this->routeMatch->setParam('action', 'deleteAjax');
     $this->getRequest()->getPost()->fromArray(['ids' => $id]);
     $jsonModel = $this->dispatchRequest();
     $this->assertEquals(200, $this->controller->getResponse()->getStatusCode());
     $this->assertEquals('success', $jsonModel->getVariable('message')['type']);
 }
开发者ID:veniva,项目名称:zcms,代码行数:14,代码来源:ListingControllerTest.php

示例10: testIsActiveReturnsFalseWhenMatchingRouteButNonMatchingParams

 public function testIsActiveReturnsFalseWhenMatchingRouteButNonMatchingParams()
 {
     $page = new Page\Mvc(array('label' => 'foo', 'route' => 'bar', 'action' => 'baz'));
     $routeMatch = new RouteMatch(array());
     $routeMatch->setMatchedRouteName('bar');
     $routeMatch->setParam('action', 'qux');
     $page->setRouteMatch($routeMatch);
     $this->assertFalse($page->isActive());
 }
开发者ID:haoyanfei,项目名称:zf2,代码行数:9,代码来源:MvcTest.php

示例11: testCanAllowAccess

 public function testCanAllowAccess()
 {
     $eventManager = $this->getMock('Zend\\EventManager\\EventManagerInterface');
     $eventManager->expects($this->never())->method('trigger');
     $application = $this->getMock('Zend\\Mvc\\Application', array(), array(), '', false);
     $application->expects($this->any())->method('getEventManager')->will($this->returnValue($eventManager));
     $routeMatch = new RouteMatch(array());
     $routeMatch->setParam("controller", "index");
     $routeMatch->setParam("action", "update");
     $event = new MvcEvent();
     $event->setRouteMatch($routeMatch);
     $event->setApplication($application);
     $controllerGuardMock = $this->getMockBuilder('UghAuthorization\\Guards\\Guard', array('isGranted'))->disableOriginalConstructor()->getMock();
     $controllerGuardMock->expects($this->any())->method('isGranted')->will($this->returnValue(true));
     $controllerGuardListener = new ControllerGuardListener($controllerGuardMock);
     $controllerGuardListener->onGuard($event);
     $this->assertFalse($event->propagationIsStopped());
     $this->assertEmpty($event->getError());
 }
开发者ID:ughly,项目名称:ugh-authorization,代码行数:19,代码来源:ControllerGuardListenerTest.php

示例12: testListActionWithFilledConfiguration

 public function testListActionWithFilledConfiguration()
 {
     $this->markTestIncomplete();
     $configuration = array('name_to_configuration_path' => array('locator_one' => __FILE__, 'locator_two' => __FILE__));
     $console = $this->console;
     $console->shouldReceive('writeLine')->with('locator: locator_one with configuration file "' . __FILE__ . '"')->once();
     $console->shouldReceive('writeLine')->with('locator: locator_two with configuration file "' . __FILE__ . '"')->once();
     $this->controller->setConfiguration($configuration);
     $this->routeMatch->setParam('action', 'list');
     $this->controller->dispatch($this->request);
 }
开发者ID:bazzline,项目名称:zf_cli_generator,代码行数:11,代码来源:IndexControllerTest.php

示例13: onDispatchError

 public function onDispatchError(MvcEvent $e)
 {
     if ($e->getError() !== Zf2Application::ERROR_ROUTER_NO_MATCH) {
         return;
     }
     $routeMatch = new RouteMatch(array());
     $routeMatch->setParam('controller', 'Zf1Module\\DispatchController');
     $e->setError(null);
     $e->setRouteMatch($routeMatch);
     return $routeMatch;
 }
开发者ID:xemlock,项目名称:Zf1Module,代码行数:11,代码来源:DispatchListener.php

示例14: testPageCheckControllerGetMethodWithExistingPage

 /**
  * Test Page Check Controller with Existing Page
  *
  * @return void
  *
  * @covers \Rcm\Controller\PageCheckController
  */
 public function testPageCheckControllerGetMethodWithExistingPage()
 {
     $this->mockPageValidator->expects($this->any())->method('isValid')->will($this->returnValue(false));
     $this->mockPageValidator->expects($this->any())->method('getMessages')->will($this->returnValue(["pageExists" => 'Page Exists']));
     $this->routeMatch->setParam('pageId', 'page-exists');
     /** @var \Zend\View\Model\JsonModel $result */
     $result = $this->controller->dispatch($this->request);
     $this->assertInstanceOf('Zend\\View\\Model\\JsonModel', $result);
     $response = $this->controller->getResponse();
     $this->assertEquals(409, $response->getStatusCode());
     $result = $result->getVariables();
     $expected = ['valid' => false, 'error' => ['pageExists' => 'Page Exists']];
     $this->assertEquals($expected, $result);
 }
开发者ID:reliv,项目名称:rcm,代码行数:21,代码来源:PageCheckControllerTest.php

示例15: injectRouteMatches

 /**
  * Inject regex matches into the route matches
  *
  * @param  RouteMatch $routeMatches
  */
 protected function injectRouteMatches(RouteMatch $routeMatches, $matches)
 {
     if (!class_exists('\\ZF\\Apigility\\Admin\\Module', false)) {
         $vendor = $matches['zf_ver_vendor'];
         $version = $matches['zf_ver_version'];
         $controllerTest = $vendor . '\\V' . $version;
         if (strpos($routeMatches->getParam('controller'), $controllerTest) !== 0) {
             $controllerParts = explode('\\', $routeMatches->getParam('controller'));
             $controllerParts[0] = $vendor;
             $controllerParts[1] = 'V' . $version;
             $controller = implode('\\', $controllerParts);
             $routeMatches->setParam('controller', $controller);
         }
     }
 }
开发者ID:zpetr,项目名称:apigility-routeaccept,代码行数:20,代码来源:RouteAcceptListener.php


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