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