public function testBuildForm() { $builder = m::mock('Symfony\\Component\\Form\\FormBuilderInterface'); // map old class to new one using LegacyFormHelper $input = array('buttons' => array('save' => array('type' => LegacyFormHelper::getType('submit'), 'options' => array('label' => 'button.save')), 'cancel' => array('type' => LegacyFormHelper::getType('button'), 'options' => array('label' => 'button.cancel')))); $buttonBuilder = new ButtonBuilder('name'); $builder->shouldReceive('add')->with(m::anyOf('save', 'cancel'), m::anyOf(LegacyFormHelper::getType('submit'), LegacyFormHelper::getType('button')), m::hasKey('label'))->twice()->andReturn($buttonBuilder); $this->type = new FormActionsType(); $this->type->buildForm($builder, $input); }
/** * @covers Braincrafted\Bundle\BootstrapBundle\Form\Type\BootstrapCollectionType::getParent() */ public function testGetParent() { $this->assertEquals(LegacyFormHelper::getType('collection'), $this->type->getParent()); }
/** * {@inheritDoc} */ public function getParent() { // map old class to new one using LegacyFormHelper return LegacyFormHelper::getType('collection'); }
/** * {@inheritdoc} * Although we only support a field that provides a somewhat text-value we extend the form field. * (to be more precise: all fields which will be rendered as form_widget_simple) * If not we would have to create for every of the text-based types an own extension class. * This way we also support new text-based types out of the box. */ public function getExtendedType() { // map old class to new one using LegacyFormHelper return LegacyFormHelper::getType('form'); }
/** * @covers Braincrafted\Bundle\BootstrapBundle\Form\Extension\TypeSetterExtension::getExtendedType() */ public function testGetExtendedType() { // map old class to new one using LegacyFormHelper $this->assertEquals(LegacyFormHelper::getType('form'), $this->extension->getExtendedType()); }
/** * @covers Braincrafted\Bundle\BootstrapBundle\Form\Extension\InputGroupButtonExtension::getExtendedType() */ public function testGetExtendedType() { $this->assertEquals(LegacyFormHelper::getType('text'), $this->extension->getExtendedType()); }