/** * {@inheritdoc} */ public function getData(Grid $grid, Parameters $parameters) { $dataSource = $this->dataSourceProvider->getDataSource($grid, $parameters); $this->filtersApplicator->apply($dataSource, $grid, $parameters); $this->sorter->sort($dataSource, $grid, $parameters); return $dataSource->getData($parameters); }
function it_gets_data_from_the_data_source(DataSourceProviderInterface $dataSourceProvider, DataSourceInterface $dataSource, FiltersApplicatorInterface $filtersApplicator, SorterInterface $sorter, Grid $grid, Parameters $parameters) { $dataSourceProvider->getDataSource($grid, $parameters)->willReturn($dataSource); $filtersApplicator->apply($dataSource, $grid, $parameters)->shouldBeCalled(); $sorter->sort($dataSource, $grid, $parameters)->shouldBeCalled(); $dataSource->getData($parameters)->willReturn(['foo', 'bar']); $this->getData($grid, $parameters)->shouldReturn(['foo', 'bar']); }