/** * testProcessCreatesResponseParameterBag */ public function testProcessCreatesResponseParameterBag() { Phake::when($this->queryBuilder)->getEntityManager()->thenReturn($this->em); Phake::when($this->queryBuilder)->getQuery()->thenReturn($this->query); Phake::when($this->em)->createNativeQuery(Phake::anyParameters())->thenReturn($this->query); Phake::when($this->queryBuilder)->getParameters()->thenReturn($this->arrayCollection); Phake::when($this->query)->getResult()->thenReturn(array()); Phake::when($this->queryBuilder)->select(Phake::anyParameters())->thenReturn($this->queryBuilder); Phake::when($this->query)->getArrayResult()->thenReturn(array(array())); Phake::when($this->query)->getSingleResult()->thenReturn(array()); Phake::when($this->arrayCollection)->toArray()->thenReturn(array()); $result = $this->service->process(); Phake::verify($this->query, Phake::atLeast(2))->getSingleResult(); $this->assertInstanceOf('Brown298\\DataTablesBundle\\Model\\ResponseParameterBag', $result); }
/** * tells the processor to run * * @param ResponseParameterBag $responseParameters * @param bool $getEntity * * @return mixed */ public function process(ResponseParameterBag $responseParameters = null, $getEntity = false) { // add the offset if ($this->offset != null) { $this->requestParameters->setOffset($this->getOffset()); } // add the limit if ($this->limit != null) { $this->requestParameters->setDisplayLength($this->limit); } // add ordering; $this->addOrdering($this->orderBy); // add criteria $this->addCriteria($this->criteria); return parent::process($responseParameters, $getEntity); }