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


PHP Router::expects方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     $this->matcher = $this->getMockBuilder('Knp\\Menu\\Matcher\\Matcher')->disableOriginalConstructor()->getMock();
     $this->router = $this->getMockBuilder('Symfony\\Component\\Routing\\Router')->disableOriginalConstructor()->getMock();
     $this->provider = $this->getMockBuilder('Oro\\Bundle\\NavigationBundle\\Provider\\BuilderChainProvider')->disableOriginalConstructor()->getMock();
     $this->factory = $this->getMockBuilder('Knp\\Menu\\MenuFactory')->setMethods(['getRouteInfo', 'processRoute'])->getMock();
     $routeCollection = new RouteCollection();
     $routeCollection->add('route_without_frontend', new Route('route_without_frontend'));
     $routeCollection->add('route_with_frontend_true', (new Route('route_with_frontend_true'))->setOption('frontend', true));
     $routeCollection->add('route_with_frontend_false', (new Route('route_with_frontend_false'))->setOption('frontend', false));
     $this->router->expects($this->any())->method('getRouteCollection')->will($this->returnValue($routeCollection));
     $this->manager = new BreadcrumbManager($this->provider, $this->matcher, $this->router);
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:13,代码来源:BreadcrumbManagerTest.php

示例2: testPrepareContextTitleDataEvent

 public function testPrepareContextTitleDataEvent()
 {
     $item = [];
     $item['title'] = 'title';
     $item['targetId'] = 1;
     $targetClass = Email::ENTITY_CLASS;
     $expectedItem = ['title' => 'new title', 'link' => 'link', 'targetId' => 1];
     $entity = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Entity\\Email')->disableOriginalConstructor()->getMock();
     $this->doctrineHelper->expects($this->once())->method('getEntity')->willReturn($entity);
     $this->router->expects($this->once())->method('generate')->willReturn('link');
     $entity->expects($this->once())->method('getSubject')->willReturn('new title');
     $event = new PrepareContextTitleEvent($item, $targetClass);
     $this->listener->prepareEmailContextTitleEvent($event);
     $this->assertEquals($expectedItem, $event->getItem());
 }
开发者ID:ramunasd,项目名称:platform,代码行数:15,代码来源:PrepareContextTitleListenerTest.php

示例3: testRegularSignInFlowWithForwardUri

 public function testRegularSignInFlowWithForwardUri()
 {
     $requestToken = array('oauth_token' => 'foo', 'oauth_token_secret' => 'bar');
     $redirectUrl = 'https://api.twitter.com/oauth/authenticate?oauth_token=foo';
     $callbackUrl = 'http://localhost/callback';
     $referer = '/foobar';
     $forwardUri = '/forward_me';
     $this->twitterMock->expects($this->once())->method('getRequestToken')->with($callbackUrl)->will($this->returnValue($requestToken));
     $this->twitterMock->expects($this->once())->method('generateAuthRedirectUrl')->with($requestToken)->will($this->returnValue($redirectUrl));
     $this->routerMock->expects($this->once())->method('generate')->with('rabus_twitter_signin_callback', array(), true)->will($this->returnValue($callbackUrl));
     $request = Request::create('http://localhost/authenticate', 'GET', array('forward_uri' => $forwardUri));
     $request->setSession($this->session);
     $request->headers->add(array('Referer' => $referer));
     $response = $this->controller->authenticateAction($request);
     $this->assertEquals(302, $response->getStatusCode());
     $this->assertTrue($response->isRedirect($redirectUrl));
     $this->assertEquals($requestToken, $this->session->get('rabus_twitter_request_token'));
     $this->assertEquals($forwardUri, $this->session->get('rabus_twitter_forward_uri'));
 }
开发者ID:derrabus,项目名称:twitter-signin-bundle,代码行数:19,代码来源:TwitterSignInControllerTest.php


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