public function testStreamTwig() { $twig = $this->getMockBuilder('\\Twig_Environment')->disableOriginalConstructor()->getMock(); $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->assertInstanceOf('Symfony\\Component\\HttpFoundation\\StreamedResponse', $controller->stream('foo')); }
public function testStreamTemplating() { $templating = $this->getMockBuilder('Symfony\\Component\\Routing\\RouterInterface')->getMock(); $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->assertInstanceOf('Symfony\\Component\\HttpFoundation\\StreamedResponse', $controller->stream('foo')); }