コード例 #1
0
 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]);
 }
コード例 #2
0
 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);
 }