public function index(Request $httpRequest)
 {
     $queryString = $httpRequest->query('q');
     $request = new ListCouponsRequest($queryString, $this->getPaginationDTO(20));
     $response = new ListCouponsResponse();
     $this->dispatchQuery(new ListCouponsQuery($request, $response));
     $coupons = $response->getCouponDTOs();
     $pagination = $response->getPaginationDTO();
     return $this->renderTemplate('admin/coupon/index.twig', ['coupons' => $coupons, 'pagination' => $pagination, 'queryString' => $queryString]);
 }
 public function testHandle()
 {
     $couponService = $this->mockService->getCouponService();
     $queryString = 'PCT';
     $request = new ListCouponsRequest($queryString, new PaginationDTO());
     $response = new ListCouponsResponse();
     $handler = new ListCouponsHandler($couponService, $this->getDTOBuilderFactory());
     $handler->handle(new ListCouponsQuery($request, $response));
     $this->assertTrue($response->getCouponDTOs()[0] instanceof CouponDTO);
     $this->assertTrue($response->getPaginationDTO() instanceof PaginationDTO);
 }