/**
  * {@inheritdoc}
  */
 public function getOptionCode()
 {
     if (null === $this->option) {
         throw new \BadMethodCallException('The option have not been created yet so you cannot access proxy methods.');
     }
     return $this->option->getCode();
 }
 function it_builds_a_form_using_option_code_as_label_if_name_is_empty(FormBuilderInterface $builder, OptionInterface $option)
 {
     $option->getId()->shouldBeCalled()->willReturn(3);
     $option->getName()->shouldBeCalled()->willReturn(null);
     $option->getCode()->shouldBeCalled()->willReturn('option_code');
     $builder->add('3', 'sylius_varibale_name_option_value_choice', ['label' => 'option_code', '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');
     $option->getCode()->shouldBeCalled()->willReturn('option-name-code');
     $builder->add('option-name-code', '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]);
 }
Exemple #4
0
 function it_returns_its_option_code(OptionInterface $option)
 {
     $option->getCode()->willReturn('01');
     $this->setOption($option);
     $this->getOptionCode()->shouldReturn('01');
 }