public function testWithInvalidSettings() { $logger = $this->getMock('Psr\\Log\\LoggerInterface'); $logger->expects($this->exactly(1))->method('error'); $service = $this->getMock('Sonata\\BlockBundle\\Block\\AbstractBlockService'); $service->expects($this->exactly(2))->method('setDefaultSettings'); $blockLoader = $this->getMock('Sonata\\BlockBundle\\Block\\BlockLoaderInterface'); $serviceManager = $this->getMock('Sonata\\BlockBundle\\Block\\BlockServiceManagerInterface'); $serviceManager->expects($this->exactly(2))->method('get')->will($this->returnValue($service)); $block = $this->getMock('Sonata\\BlockBundle\\Model\\BlockInterface'); $block->expects($this->once())->method('getSettings')->will($this->returnValue(array('template' => array()))); $manager = new BlockContextManager($blockLoader, $serviceManager, array(), $logger); $blockContext = $manager->get($block); $this->assertInstanceOf('Sonata\\BlockBundle\\Block\\BlockContextInterface', $blockContext); }