public function testUpdatePropertiesByKey() { $this->ticketRepository->expects($this->once())->method('get')->will($this->returnValue($this->ticket)); $properties = array('subject' => 'DUMMY_SUBJECT_UPDT_BY_KEY', 'description' => 'DUMMY_DESC_UPDT_BY_KEY', 'status' => 'open', 'priority' => 'high', 'source' => 'phone'); $this->ticket->expects($this->once())->method('updateProperties')->with($this->equalTo($properties)); $this->ticket->expects($this->once())->method('getId')->will($this->returnValue(1)); $this->ticketRepository->expects($this->once())->method('getByTicketKey')->with(new TicketKey('DT', 1))->will($this->returnValue($this->ticket)); $this->ticketRepository->expects($this->once())->method('store')->with($this->equalTo($this->ticket)); $this->authorizationService->expects($this->any())->method('isActionPermitted')->with($this->anything(), $this->equalTo($this->ticket))->will($this->returnValue(true)); $command = new UpdatePropertiesCommand(); $command->key = static::DUMMY_TICKET_KEY; $command->properties = $properties; $this->ticketService->updatePropertiesByKey($command); }
/** * Update certain properties of the Ticket by key * * @ApiDoc( * description="Update ticket by key", * uri="/tickets/{key}.{_format}", * method={ * "PUT", * "PATCH" * }, * resource=true, * requirements={ * { * "name"="key", * "dataType"="string", * "requirement"="^.*-[0-9]+$", * "description"="Ticket Key" * } * }, * statusCodes={ * 200="Returned when successful", * 403="Returned when the user is not authorized to update ticket", * 404="Returned when the ticket is not found" * } * ) * * @param Command\UpdatePropertiesCommand $command * @return \Diamante\DeskBundle\Model\Ticket\Ticket */ public function updatePropertiesByKey(Command\UpdatePropertiesCommand $command) { return parent::updatePropertiesByKey($command); }