/** * getQueryBuilder * * @param \Symfony\Component\HttpFoundation\Request $request * * @return null */ protected function getQueryBuilder(Request $request) { if ($this->dataTable == null) { $this->dataTable = new QueryBuilderDataTable(); $this->dataTable->setContainer($this->container); } return $this->dataTable->getQueryBuilder($request); }
/** * 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); }