public function index(Request $httpRequest)
 {
     $queryString = $httpRequest->query('q');
     $request = new ListUsersRequest($queryString, $this->getPaginationDTO(20));
     $response = new ListUsersResponse();
     $this->dispatchQuery(new ListUsersQuery($request, $response));
     $users = $response->getUserDTOs();
     $pagination = $response->getPaginationDTO();
     return $this->renderTemplate('admin/user/index.twig', ['users' => $users, 'pagination' => $pagination, 'queryString' => $queryString]);
 }
Ejemplo n.º 2
0
 public function testHandle()
 {
     $userService = $this->mockService->getUserService();
     $dtoBuilderFactory = $this->getDTOBuilderFactory();
     $queryString = 'john';
     $request = new ListUsersRequest($queryString, new PaginationDTO());
     $response = new ListUsersResponse();
     $handler = new ListUsersHandler($userService, $dtoBuilderFactory);
     $handler->handle(new ListUsersQuery($request, $response));
     $this->assertTrue($response->getUserDTOs()[0] instanceof UserDTO);
     $this->assertTrue($response->getPaginationDTO() instanceof PaginationDTO);
 }