コード例 #1
0
 /**
  * @test
  */
 public function thatCommentUpdatesV2()
 {
     $comment = new Comment(self::DUMMY_COMMENT_CONTENT, $this->_dummyTicket, $this->createDiamanteUser(), false);
     $updatedContent = self::DUMMY_COMMENT_CONTENT . ' (edited)';
     $this->commentRepository->expects($this->once())->method('get')->with($this->equalTo(self::DUMMY_COMMENT_ID))->will($this->returnValue($comment));
     $this->commentRepository->expects($this->once())->method('store')->with($this->equalTo($comment));
     $this->authorizationService->expects($this->once())->method('isActionPermitted')->with($this->equalTo('EDIT'), $comment)->will($this->returnValue(true));
     $command = new UpdateCommentCommand();
     $command->id = self::DUMMY_COMMENT_ID;
     $command->content = $updatedContent;
     $command->ticketStatus = Status::IN_PROGRESS;
     $this->service->updateCommentContentAndTicketStatus($command);
     $this->assertEquals($updatedContent, $comment->getContent());
     $this->assertEquals(Status::IN_PROGRESS, $comment->getTicket()->getStatus()->getValue());
 }
コード例 #2
0
 /**
  * Update certain properties of the Comment
  *
  * @ApiDoc(
  *  description="Update comment",
  *  uri="/comments/{id}.{_format}",
  *  method={
  *      "PUT",
  *      "PATCH"
  *  },
  *  resource=true,
  *  requirements={
  *      {
  *          "name"="id",
  *          "dataType"="integer",
  *          "requirement"="\d+",
  *          "description"="Comment Id"
  *      }
  *  },
  *  statusCodes={
  *      200="Returned when successful",
  *      403="Returned when the user is not authorized to update comment",
  *      404="Returned when the comment is not found"
  *  }
  * )
  *
  * @param Command\UpdateCommentCommand $command
  * @param boolean $flush
  * @return Comment
  */
 public function updateCommentContentAndTicketStatus(Command\UpdateCommentCommand $command, $flush = false)
 {
     return parent::updateCommentContentAndTicketStatus($command, true);
 }
コード例 #3
0
 /**
  * Update certain properties of the Comment
  *
  * @ApiDoc(
  *  description="Update comment",
  *  uri="/comments/{id}.{_format}",
  *  method={
  *      "PUT",
  *      "PATCH"
  *  },
  *  resource=true,
  *  requirements={
  *      {
  *          "name"="id",
  *          "dataType"="integer",
  *          "requirement"="\d+",
  *          "description"="Comment Id"
  *      }
  *  },
  *  statusCodes={
  *      200="Returned when successful",
  *      403="Returned when the user is not authorized to update comment",
  *      404="Returned when the comment is not found"
  *  }
  * )
  *
  * @param Command\UpdateCommentCommand $command
  * @return Comment
  */
 public function updateCommentContentAndTicketStatus(Command\UpdateCommentCommand $command)
 {
     return parent::updateCommentContentAndTicketStatus($command);
 }