public function testSimpleRun() { $items = $this->em->getRepository('Test\\TestBundle\\Entity\\Client')->findAll(); /** @var RestResponse $restResponse */ $restResponse = $this->action->setArrayOfEntitiesToSendBack($items)->setTotalCountOfEntitiesInDB(300)->setClassName('Test\\TestBundle\\Entity\\Client')->init()->run(); $this->assertTrue($restResponse->isSuccess()); $this->assertEquals(300, $restResponse->getTotal()); $this->assertCount(count($items), $restResponse->getData()); $this->assertEquals(RestResponse::STATUS_CODE_OK, $restResponse->getStatusCode()); }
/** * Производит всю работу по приобретению данных для выдачи данных GET ALL запроса * @param ParamFetcherInterface $paramFetcher * @param string[] $groups * * @return RestResponse */ protected function doGetAll(ParamFetcherInterface $paramFetcher, $groups = []) { $action = new GetAllAction(); $totalItemsCount = 0; $entities = $this->gatherEntities($paramFetcher, $totalItemsCount); $this->addAdditionalDataToEntities($entities, $groups); $action->setTotalCountOfEntitiesInDB($totalItemsCount)->setArrayOfEntitiesToSendBack($entities); $this->initAction($action); /** @var RestResponse $actionResult */ $actionResult = $action->run(); return $actionResult; }