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]);
 }
 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('Sylius\\Bundle\\VariationBundle\\Form\\DataTransformer\\VariantToCombinationTransformer'))->shouldBeCalled();
     $this->buildForm($builder, array('variable' => $variable));
 }
 function it_build_a_form($manager, FormBuilderInterface $builder, ObjectRepository $repository)
 {
     $manager->getRepository('class')->willReturn($repository);
     $builder->addModelTransformer(Argument::type(ObjectToIdentifierTransformer::class))->shouldBeCalled();
     $this->buildForm($builder, array('class' => 'class', 'identifier' => 'identifier'));
 }
Example #4
0
 public function buildForm(FormBuilderInterface $builder, array $option)
 {
     $builder->add('autor')->add('content')->add('submit', 'submit');
 }
 /**
  * @param \Symfony\Component\HttpFoundation\ParameterBag $queryAttributes
  * @param \Symfony\Component\Routing\RouterInterface $router
  * @param \Symfony\Component\Form\Test\FormBuilderInterface $formBuilder
  * @param \Symfony\Component\Form\FormView $formView
  * @param \FSi\Component\DataGrid\Column\ColumnTypeInterface $column
  * @param \FSi\Component\DataGrid\Column\HeaderViewInterface $view
  */
 function it_allows_to_pass_route_name_and_additional_parameters_to_batch_action($queryAttributes, $router, $formBuilder, $formView, $column, $view)
 {
     $column->getOption('actions')->willReturn(array('action_name' => array('route_name' => 'fsi_admin_custom_batch', 'additional_parameters' => array('element' => 'some_batch_element_id', 'param' => 'value'))));
     $column->getOption('translation_domain')->willReturn('FSiAdminBundle');
     $queryAttributes->has('redirect_uri')->willReturn(true);
     $queryAttributes->get('redirect_uri')->willReturn('some_redirect_uri');
     $router->generate('fsi_admin_custom_batch', array('element' => 'some_batch_element_id', 'param' => 'value', 'redirect_uri' => 'some_redirect_uri'))->willReturn('path_to_batch_action');
     $formBuilder->add('action', 'choice', array('choices' => array(0 => 'crud.list.batch.empty_choice', 'path_to_batch_action' => 'action_name'), 'translation_domain' => 'FSiAdminBundle'))->willReturn();
     $formBuilder->add('submit', 'submit', array('label' => 'crud.list.batch.confirm', 'translation_domain' => 'FSiAdminBundle'))->willReturn();
     $view->setAttribute('batch_form', $formView)->shouldBeCalled();
     $this->buildHeaderView($column, $view);
 }