本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Controller\Controller::forward方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::forward方法的具体用法?PHP Controller::forward怎么用?PHP Controller::forward使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Bundle\FrameworkBundle\Controller\Controller
的用法示例。
在下文中一共展示了Controller::forward方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testForward
public function testForward()
{
$request = Request::create('/');
$request->setLocale('fr');
$request->setRequestFormat('xml');
$kernel = $this->getMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface');
$kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) {
return new Response($request->getRequestFormat() . '--' . $request->getLocale());
}));
$container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
$container->expects($this->at(0))->method('get')->will($this->returnValue($request));
$container->expects($this->at(1))->method('get')->will($this->returnValue($kernel));
$controller = new Controller();
$controller->setContainer($container);
$response = $controller->forward('a_controller');
$this->assertEquals('xml--fr', $response->getContent());
}
示例2: forward
public function forward($controller, array $path = array(), array $query = array())
{
return parent::forward($controller, $path, $query);
}