renderView() public method

public renderView ( $view, array $parameters = [] )
$parameters array
 public function testRenderViewTwig()
 {
     $twig = $this->getMockBuilder('\\Twig_Environment')->disableOriginalConstructor()->getMock();
     $twig->expects($this->once())->method('render')->willReturn('bar');
     $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $container->expects($this->at(0))->method('has')->will($this->returnValue(false));
     $container->expects($this->at(1))->method('has')->will($this->returnValue(true));
     $container->expects($this->at(2))->method('get')->will($this->returnValue($twig));
     $controller = new TestController();
     $controller->setContainer($container);
     $this->assertEquals('bar', $controller->renderView('foo'));
 }
Beispiel #2
0
 public function testRenderViewTemplating()
 {
     $templating = $this->getMockBuilder('Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface')->getMock();
     $templating->expects($this->once())->method('render')->willReturn('bar');
     $container = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerInterface')->getMock();
     $container->expects($this->at(0))->method('has')->willReturn(true);
     $container->expects($this->at(1))->method('get')->will($this->returnValue($templating));
     $controller = new TestController();
     $controller->setContainer($container);
     $this->assertEquals('bar', $controller->renderView('foo'));
 }