public function testService()
 {
     if (!$this->checkBlockBundle()) {
         $this->markTestSkipped('Sonata BlockBundle is not installed.');
         return;
     }
     $templating = new FakeTemplating();
     $service = new FacebookLikeBoxBlockService('sonata.block.service.facebook.like_box', $templating);
     $block = new Block();
     $block->setType('core.text');
     $block->setSettings(array('url' => 'url_setting', 'width' => 'width_setting', 'height' => 'height_setting', 'colorscheme' => 'colorscheme_setting', 'show_faces' => 'show_faces_setting', 'show_header' => 'show_header_setting', 'show_posts' => 'show_posts_setting', 'show_border' => 'show_border_setting'));
     $optionResolver = new OptionsResolver();
     $service->setDefaultSettings($optionResolver);
     $blockContext = new BlockContext($block, $optionResolver->resolve($block->getSettings()));
     $formMapper = $this->getMock('Sonata\\AdminBundle\\Form\\FormMapper', array(), array(), '', false);
     $formMapper->expects($this->exactly(2))->method('add');
     $service->buildCreateForm($formMapper, $block);
     $service->buildEditForm($formMapper, $block);
     $service->execute($blockContext);
     $this->assertEquals('url_setting', $templating->parameters['settings']['url']);
     $this->assertEquals('width_setting', $templating->parameters['settings']['width']);
     $this->assertEquals('height_setting', $templating->parameters['settings']['height']);
     $this->assertEquals('colorscheme_setting', $templating->parameters['settings']['colorscheme']);
     $this->assertEquals('show_faces_setting', $templating->parameters['settings']['show_faces']);
     $this->assertEquals('show_header_setting', $templating->parameters['settings']['show_header']);
     $this->assertEquals('show_posts_setting', $templating->parameters['settings']['show_posts']);
     $this->assertEquals('show_border_setting', $templating->parameters['settings']['show_border']);
 }
 public function testService()
 {
     $templating = new FakeTemplating();
     $service = new TextBlockService('sonata.page.block.text', $templating);
     $block = new Block();
     $block->setType('core.text');
     $block->setSettings(array('content' => 'my text'));
     $optionResolver = new OptionsResolver();
     $service->setDefaultSettings($optionResolver);
     $blockContext = new BlockContext($block, $optionResolver->resolve($block->getSettings()));
     $formMapper = $this->getMock('Sonata\\AdminBundle\\Form\\FormMapper', array(), array(), '', false);
     $formMapper->expects($this->exactly(2))->method('add');
     $service->buildCreateForm($formMapper, $block);
     $service->buildEditForm($formMapper, $block);
     $response = $service->execute($blockContext);
     $this->assertEquals('my text', $templating->parameters['settings']['content']);
 }