function it_builds_attribute_types_prototype_and_passes_it_as_argument(FormBuilder $builder, FormBuilder $fieldBuilder, FormFactoryInterface $formFactory, ChoiceListInterface $choiceList, AttributeInterface $attribute)
 {
     $builder->getFormFactory()->willReturn($formFactory);
     $builder->add('attribute', 'sylius_server_attribute_choice', Argument::any())->willReturn($builder);
     $builder->addEventSubscriber(Argument::any())->willReturn($builder);
     $attribute->getType()->willReturn('checkbox')->shouldBeCalled();
     $attribute->getConfiguration()->willReturn(array('label' => 'sylius.form.attribute.server_attribute_value.value'))->shouldBeCalled();
     $choiceList->getChoices()->willReturn(array($attribute));
     $fieldBuilder->getOption('choice_list')->willReturn($choiceList);
     $builder->get('attribute')->willReturn($fieldBuilder);
     $builder->create('value', 'checkbox', array('label' => 'sylius.form.attribute.server_attribute_value.value'))->shouldBeCalled()->willReturn($fieldBuilder);
     $fieldBuilder->getForm()->willReturn('Form for attribute');
     $builder->setAttribute('prototypes', array(0 => 'Form for attribute'))->shouldBeCalled();
     $this->buildForm($builder, array());
 }
Example #2
0
 function it_returns_its_attribute_configuration(AttributeInterface $attribute)
 {
     $attribute->getConfiguration()->willReturn(array('choices' => array('Red')));
     $this->setAttribute($attribute);
     $this->getConfiguration()->shouldReturn(array('choices' => array('Red')));
 }