public function testOptionWithValidContext()
 {
     $blockService = $this->getMock('Sonata\\BlockBundle\\Block\\BlockServiceInterface');
     $blockService->expects($this->once())->method('getName')->will($this->returnValue('value'));
     $blockServiceManager = $this->getMock('Sonata\\BlockBundle\\Block\\BlockServiceManagerInterface');
     $blockServiceManager->expects($this->once())->method('getServicesByContext')->with($this->equalTo('cms'))->will($this->returnValue(array('my.service.code' => $blockService)));
     $type = new ServiceListType($blockServiceManager, array('cms' => array('my.service.code')));
     $resolver = new OptionsResolver();
     $type->setDefaultOptions($resolver);
     $options = $resolver->resolve(array('context' => 'cms'));
     $expected = array('multiple' => false, 'expanded' => false, 'choices' => array('my.service.code' => 'value - my.service.code'), 'preferred_choices' => array(), 'empty_data' => '', 'empty_value' => null, 'error_bubbling' => false, 'context' => 'cms', 'include_containers' => false);
     $this->assertEquals($expected, $options);
 }
 public function __construct(BlockServiceManagerInterface $manager, array $contexts = array())
 {
     parent::__construct($manager, $contexts);
     $this->contexts = array('cms' => 1, 'admin' => 1);
 }