public function execute(BlockContextInterface $blockContext, Response $response = null) { return $this->renderResponse($blockContext->getTemplate(), array('block' => $blockContext->getBlock()), $response); }
public function testExecute() { $engineInterfaceMock = $this->getMockBuilder('Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface')->disableOriginalConstructor()->getMock(); $engineInterfaceMock->expects($this->once())->method('renderResponse')->will($this->returnValue(new Response())); $context = $this->getMock('Sonata\\BlockBundle\\Block\\BlockContextInterface'); $block = new BasketBlockService('test', $engineInterfaceMock); $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $block->execute($context)); }