/**
  * @test
  */
 public function testGetPagingPropertiesWithModifiedValues()
 {
     $command = new FilterTicketsCommand();
     $command->limit = 50;
     $command->page = 2;
     $command->sort = 'subject';
     $command->order = 'DESC';
     $processor = new TicketFilterCriteriaProcessor();
     $processor->setCommand($command);
     $pagingProperties = $processor->getPagingProperties();
     $this->assertInstanceOf('\\Diamante\\DeskBundle\\Model\\Shared\\Filter\\PagingProperties', $pagingProperties);
     $this->assertEquals(50, $pagingProperties->getLimit());
     $this->assertEquals(2, $pagingProperties->getPage());
     $this->assertEquals('subject', $pagingProperties->getSort());
     $this->assertEquals('DESC', $pagingProperties->getOrder());
 }
 /**
  * Retrieves list of all Tickets. Performs filtering of tickets if provided with criteria as GET parameters.
  * Time filtering parameters as well as paging/sorting configuration parameters can be found in \Diamante\DeskBundle\Api\Command\Filter\CommonFilterCommand class.
  * Time filtering values should be converted to UTC
  *
  * @ApiDoc(
  *  description="Returns all tickets.",
  *  uri="/tickets.{_format}",
  *  method="GET",
  *  resource=true,
  *  statusCodes={
  *      200="Returned when successful",
  *      403="Returned when the user is not authorized to list tickets"
  *  }
  * )
  *
  * @param Command\Filter\FilterTicketsCommand $ticketFilterCommand
  * @return \Diamante\DeskBundle\Entity\Ticket[]
  */
 public function listAllTickets(Command\Filter\FilterTicketsCommand $ticketFilterCommand)
 {
     $criteriaProcessor = new TicketFilterCriteriaProcessor();
     $criteriaProcessor->setCommand($ticketFilterCommand);
     $criteria = $criteriaProcessor->getCriteria();
     $pagingProperties = $criteriaProcessor->getPagingProperties();
     $repository = $this->getTicketRepository();
     $user = $this->getAuthorizationService()->getLoggedUser();
     if ($user instanceof ApiUser) {
         $user = $this->userService->getUserFromApiUser($user);
     }
     $tickets = $repository->filter($criteria, $pagingProperties, $user);
     try {
         $pagingInfo = $this->apiPagingService->getPagingInfo($repository, $pagingProperties, $criteria);
         $this->populatePagingHeaders($this->apiPagingService, $pagingInfo);
     } catch (\Exception $e) {
     }
     return $tickets;
 }