function it_build_form_with_proper_fields(FormBuilderInterface $builder, FormFactoryInterface $factory, $dataFetcherRegistry, $rendererRegistry, RendererInterface $renderer, DataFetcherInterface $dataFetcher) { $builder->getFormFactory()->willReturn($factory); $builder->add('name', 'text', Argument::any())->shouldBeCalled()->willReturn($builder); $builder->add('description', 'textarea', Argument::any())->shouldBeCalled()->willReturn($builder); $builder->add('renderer', 'sylius_renderer_choice', Argument::any())->shouldBeCalled()->willReturn($builder); $builder->add('dataFetcher', 'sylius_data_fetcher_choice', Argument::any())->shouldBeCalled()->willReturn($builder); $builder->addEventSubscriber(Argument::type(BuildReportRendererFormSubscriber::class))->shouldBeCalled()->willReturn($builder); $builder->addEventSubscriber(Argument::type(BuildReportDataFetcherFormSubscriber::class))->shouldBeCalled()->willReturn($builder); $builder->addEventSubscriber(Argument::type(AddCodeFormSubscriber::class))->shouldBeCalled()->willReturn($builder); $renderer->getType()->willReturn('sylius_renderer_test_renderer'); $rendererRegistry->all()->willReturn(['test_renderer' => $renderer]); $builder->create('rendererConfiguration', 'sylius_renderer_test_renderer')->willReturn($builder); $builder->getForm()->shouldBeCalled()->willReturn(Argument::type(Form::class)); $dataFetcher->getType()->willReturn('sylius_data_fetcher_test_data_fetcher'); $dataFetcherRegistry->all()->willReturn(['test_data_fetcher' => $dataFetcher]); $builder->create('dataFetcherConfiguration', 'sylius_data_fetcher_test_data_fetcher')->willReturn($builder); $builder->getForm()->shouldBeCalled()->willReturn(Argument::type(Form::class)); $prototypes = ['renderers' => ['test_renderer' => Argument::type(Form::class)], 'dataFetchers' => ['test_data_fetcher' => Argument::type(Form::class)]]; $builder->setAttribute('prototypes', $prototypes)->shouldBeCalled(); $this->buildForm($builder, []); }
function it_build_form_with_proper_fields(FormBuilderInterface $builder, FormFactoryInterface $factory, $dataFetcherRegistry, $rendererRegistry, RendererInterface $renderer, DataFetcherInterface $dataFetcher) { $builder->getFormFactory()->willReturn($factory); $builder->add('name', 'text', Argument::any())->shouldBeCalled()->willReturn($builder); $builder->add('description', 'textarea', Argument::any())->shouldBeCalled()->willReturn($builder); $builder->add('renderer', 'sylius_renderer_choice', Argument::any())->shouldBeCalled()->willReturn($builder); $builder->add('dataFetcher', 'sylius_data_fetcher_choice', Argument::any())->shouldBeCalled()->willReturn($builder); $builder->addEventSubscriber(Argument::type('Sylius\\Bundle\\ReportBundle\\Form\\EventListener\\BuildReportRendererFormSubscriber'))->shouldBeCalled()->willReturn($builder); $builder->addEventSubscriber(Argument::type('Sylius\\Bundle\\ReportBundle\\Form\\EventListener\\BuildReportDataFetcherFormSubscriber'))->shouldBeCalled()->willReturn($builder); $builder->addEventSubscriber(Argument::type(AddCodeFormSubscriber::class))->shouldBeCalled()->willReturn($builder); $renderer->getType()->willReturn('test_renderer'); $rendererRegistry->all()->willReturn(array('test_renderer' => $renderer)); $builder->create('rendererConfiguration', 'sylius_renderer_test_renderer')->willReturn($builder); $builder->getForm()->shouldBeCalled()->willReturn(Argument::type('Symfony\\Component\\Form\\Form')); $dataFetcher->getType()->willReturn('test_data_fetcher'); $dataFetcherRegistry->all()->willReturn(array('test_data_fetcher' => $dataFetcher)); $builder->create('dataFetcherConfiguration', 'sylius_data_fetcher_test_data_fetcher')->willReturn($builder); $builder->getForm()->shouldBeCalled()->willReturn(Argument::type('Symfony\\Component\\Form\\Form')); $prototypes = array('renderers' => array('test_renderer' => Argument::type('Symfony\\Component\\Form\\Form')), 'dataFetchers' => array('test_data_fetcher' => Argument::type('Symfony\\Component\\Form\\Form'))); $builder->setAttribute('prototypes', $prototypes)->shouldBeCalled(); $this->buildForm($builder, array()); }