Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function getName()
 {
     if (null === $this->option) {
         throw new \BadMethodCallException('The option have not been created yet so you cannot access proxy methods.');
     }
     return $this->option->getName();
 }
 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([$option]);
     $option->getName()->shouldBeCalled()->willReturn('option_name');
     $builder->add('option-name', 'sylius_varibale_name_option_value_choice', ['label' => 'option_name', 'option' => $option, 'property_path' => '[0]'])->shouldBeCalled();
     $builder->addModelTransformer(Argument::type(VariantToCombinationTransformer::class))->shouldBeCalled();
     $this->buildForm($builder, ['variable' => $variable]);
 }
Esempio n. 4
0
 function it_returns_its_option_name(OptionInterface $option)
 {
     $option->getName()->willReturn('T-Shirt size');
     $this->setOption($option);
     $this->getName()->shouldReturn('T-Shirt size');
 }
Esempio n. 5
0
 function it_returns_its_option_presentation(OptionInterface $option)
 {
     $option->getName()->willReturn('Size');
     $this->setOption($option);
     $this->getPresentation()->shouldReturn('Size');
 }