public function index(Request $httpRequest) { $queryString = $httpRequest->query('q'); $request = new ListOptionsRequest($queryString, $this->getPaginationDTO(20)); $response = new ListOptionsResponse(); $this->dispatchQuery(new ListOptionsQuery($request, $response)); $options = $response->getOptionDTOs(); $pagination = $response->getPaginationDTO(); return $this->renderTemplate('admin/option/index.twig', ['options' => $options, 'pagination' => $pagination, 'queryString' => $queryString]); }
public function testHandle() { $optionService = $this->mockService->getOptionService(); $dtoBuilderFactory = $this->getDTOBuilderFactory(); $queryString = 'TT'; $request = new ListOptionsRequest($queryString, new PaginationDTO()); $response = new ListOptionsResponse(); $handler = new ListOptionsHandler($optionService, $dtoBuilderFactory); $handler->handle(new ListOptionsQuery($request, $response)); $this->assertTrue($response->getOptionDTOs()[0] instanceof OptionDTO); $this->assertTrue($response->getPaginationDTO() instanceof PaginationDTO); }