/** * dataAction * * @param Request $request * * @param null $dataFormatter * * @return JsonResponse */ public function dataAction(Request $request, $dataFormatter = null) { $this->dataTable = new QueryBuilderDataTable(); $this->dataTable->setContainer($this->container); $this->dataTable->setColumns($this->columns); $this->dataTable->setQueryBuilder($this->getQueryBuilder($request)); return $this->dataTable->getJsonResponse($request, $dataFormatter); }
/** * testGetQueryBuilderGenerate */ public function testGetQueryBuilderGenerate() { $expectedResults = 'asdf'; $this->dataTable->setMetaData(array('table' => $this->table)); $this->table->entity = 'test'; $this->dataTable->setEm($this->em); $this->repo->testing = function () { }; Phake::when($this->em)->getRepository(Phake::anyParameters())->thenReturn($this->repo); Phake::when($this->repo)->createQueryBuilder(Phake::anyParameters())->thenReturn($expectedResults); $result = $this->dataTable->getQueryBuilder(); $this->assertEquals($expectedResults, $result); }