public function testBuildFormSeveralChoices()
 {
     $pool = $this->getMockBuilder('Sonata\\FormatterBundle\\Formatter\\Pool')->disableOriginalConstructor()->getMock();
     $translator = $this->getMock('Symfony\\Component\\Translation\\TranslatorInterface');
     $configManager = $this->getMock('Ivory\\CKEditorBundle\\Model\\ConfigManagerInterface');
     $type = new FormatterType($pool, $translator, $configManager);
     $choiceFormBuilder = $this->getMock('Symfony\\Component\\Form\\FormBuilderInterface');
     $choiceFormBuilder->expects($this->once())->method('getOption')->with('choices')->will($this->returnValue(array('foo' => 'bar', 'foo2' => 'bar2')));
     $formBuilder = $this->getMock('Symfony\\Component\\Form\\FormBuilderInterface');
     $formBuilder->expects($this->exactly(2))->method('add');
     $formBuilder->expects($this->once())->method('get')->will($this->returnValue($choiceFormBuilder));
     $options = array('format_field' => 'format', 'source_field' => 'source', 'format_field_options' => array('property_path' => ''), 'source_field_options' => array('property_path' => ''), 'listener' => false);
     $type->buildForm($formBuilder, $options);
 }
 public function testBuildViewWithDefaultConfigAndWithToolbarIcons()
 {
     $pool = $this->getMockBuilder('Sonata\\FormatterBundle\\Formatter\\Pool')->disableOriginalConstructor()->getMock();
     $translator = $this->getMock('Symfony\\Component\\Translation\\TranslatorInterface');
     $configManager = $this->getMock('Ivory\\CKEditorBundle\\Model\\ConfigManagerInterface');
     $defaultConfig = 'default';
     $defaultConfigValues = array('toolbar' => array('Button 1'));
     $configManager->expects($this->once())->method('getDefaultConfig')->will($this->returnValue($defaultConfig));
     $configManager->expects($this->once())->method('hasConfig')->with($defaultConfig)->will($this->returnValue(true));
     $configManager->expects($this->once())->method('getConfig')->with($defaultConfig)->will($this->returnValue($defaultConfigValues));
     $type = new FormatterType($pool, $translator, $configManager);
     $ckEditorToolBarIcons = array('Icon 1');
     /** @var \Symfony\Component\Form\FormView $view */
     $view = $this->getMock('Symfony\\Component\\Form\\FormView');
     $view->vars['id'] = 'SomeId';
     $view->vars['name'] = 'SomeName';
     $form = $this->getMock('Symfony\\Component\\Form\\FormInterface');
     $type->buildView($view, $form, array('source_field' => 'SomeField', 'format_field' => 'SomeFormat', 'format_field_options' => 'SomeOptions', 'ckeditor_context' => null, 'ckeditor_basepath' => '', 'ckeditor_toolbar_icons' => $ckEditorToolBarIcons));
     $this->assertSame($view->vars['ckeditor_configuration'], array('toolbar' => $defaultConfigValues['toolbar']));
 }