本文整理汇总了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);
}
示例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());
}
示例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'));
}