コード例 #1
0
 public function it_delegates_data_fetcher_to_report($serviceRegistryInterface, ReportInterface $subject, DataFetcherInterface $dataFetcher)
 {
     $subject->getDataFetcher()->willReturn('default_data_fetcher');
     $subject->getDataFetcherConfiguration()->willReturn([]);
     $serviceRegistryInterface->get('default_data_fetcher')->willReturn($dataFetcher);
     $dataFetcher->fetch([])->shouldBeCalled()->willReturn([['date' => '2014-12-31', 'user_total' => '20']]);
     $this->fetch($subject)->shouldReturn([['date' => '2014-12-31', 'user_total' => '20']]);
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  *
  * @throws \InvalidArgumentException If the report does not have a data fetcher.
  */
 public function fetch(ReportInterface $report, array $configuration = [])
 {
     if (null === ($type = $report->getDataFetcher())) {
         throw new \InvalidArgumentException('Cannot fetch data for ReportInterface instance without DataFetcher defined.');
     }
     $dataFetcher = $this->registry->get($type);
     $configuration = empty($configuration) ? $report->getDataFetcherConfiguration() : $configuration;
     return $dataFetcher->fetch($configuration);
 }
コード例 #3
0
 function it_adds_configuration_fields_in_pre_set_data($factory, ReportInterface $report, FormEvent $event, Form $form, Form $field)
 {
     $report->getDataFetcher()->willReturn('test_data_fetcher');
     $report->getDataFetcherConfiguration()->willReturn(array());
     $event->getData()->willReturn($report);
     $event->getForm()->willReturn($form);
     $factory->createNamed('dataFetcherConfiguration', 'sylius_data_fetcher_test_type', Argument::cetera())->willReturn($field);
     $form->add($field)->shouldBeCalled();
     $this->preSetData($event);
 }