Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function getPresentation()
 {
     if (null === $this->option) {
         throw new \BadMethodCallException('The option have not been created yet so you cannot access proxy methods.');
     }
     return $this->option->getPresentation();
 }
 function it_builds_a_form_using_option_name_as_label_if_presentation_is_empty(FormBuilderInterface $builder, OptionInterface $option)
 {
     $option->getId()->shouldBeCalled()->willReturn(3);
     $option->getPresentation()->shouldBeCalled()->willReturn('option_presentation');
     $option->getName()->shouldNotBeCalled();
     $builder->add('3', 'sylius_varibale_name_option_value_choice', ['label' => 'option_presentation', 'option' => $option, 'property_path' => '[0]'])->shouldBeCalled();
     $this->buildForm($builder, ['options' => [$option]]);
 }
 function it_builds_a_form(FormBuilderInterface $builder, VariableInterface $variable, OptionInterface $option)
 {
     $variable->getOptions()->shouldBeCalled()->willReturn(array($option));
     $option->getName()->shouldBeCalled()->willReturn('option_name');
     $option->getPresentation()->shouldBeCalled()->willReturn('option_presentation');
     $builder->add('option-name', 'sylius_varibale_name_option_value_choice', array('label' => 'option_presentation', 'option' => $option, 'property_path' => '[0]'))->shouldBeCalled();
     $builder->addModelTransformer(Argument::type(VariantToCombinationTransformer::class))->shouldBeCalled();
     $this->buildForm($builder, array('variable' => $variable));
 }
Exemple #4
0
 function it_returns_its_option_presentation(OptionInterface $option)
 {
     $option->getPresentation()->willReturn('Size');
     $this->setOption($option);
     $this->getPresentation()->shouldReturn('Size');
 }