function it_builds_form_with_proper_fields(FormBuilder $builder) { $builder->addEventSubscriber(Argument::type('Sylius\\Bundle\\AttributeBundle\\Form\\EventListener\\BuildAttributeFormChoicesListener'))->shouldBeCalled()->willReturn($builder); $builder->add('translations', 'a2lix_translationsForms', Argument::any())->shouldBeCalled()->willReturn($builder); $builder->add('name', 'text', Argument::any())->shouldBeCalled()->willReturn($builder); $builder->add('type', 'choice', array('choices' => AttributeTypes::getChoices(), 'label' => 'sylius.form.attribute.type'))->shouldBeCalled()->willReturn($builder); $this->buildForm($builder, array()); }
/** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('name', 'text', array('label' => 'sylius.form.attribute.name'))->add('presentation', 'text', array('label' => 'sylius.form.attribute.presentation'))->add('type', 'choice', array('choices' => AttributeTypes::getChoices()))->addEventSubscriber(new BuildAttributeFormChoicesListener($builder->getFormFactory())); }
/** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('name', 'text', array('label' => 'sylius.form.attribute.name'))->add('translations', 'a2lix_translationsForms', array('form_type' => sprintf('sylius_%s_attribute_translation', $this->subjectName), 'label' => 'sylius.form.attribute.presentation'))->add('type', 'choice', array('choices' => AttributeTypes::getChoices(), 'label' => 'sylius.form.attribute.type'))->addEventSubscriber(new BuildAttributeFormChoicesListener($builder->getFormFactory())); }