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)); }