/** * @test */ public function thatAttachmentRemovesFromComment() { $attachment = new Attachment(new File('some/path/file.ext')); $this->commentRepository->expects($this->once())->method('get')->with($this->equalTo(self::DUMMY_COMMENT_ID))->will($this->returnValue($this->comment)); $this->comment->expects($this->once())->method('getAttachment')->with($this->equalTo(1))->will($this->returnValue($attachment)); $this->comment->expects($this->once())->method('removeAttachment')->with($this->equalTo($attachment)); $this->attachmentManager->expects($this->once())->method('deleteAttachment')->with($this->equalTo($attachment)); $this->commentRepository->expects($this->once())->method('store')->with($this->equalTo($this->comment)); $this->authorizationService->expects($this->once())->method('isActionPermitted')->with($this->equalTo('EDIT'), $this->equalTo($this->comment))->will($this->returnValue(true)); $removeCommentAttachmentCommand = new RemoveCommentAttachmentCommand(); $removeCommentAttachmentCommand->attachmentId = 1; $removeCommentAttachmentCommand->commentId = self::DUMMY_COMMENT_ID; $this->service->removeAttachmentFromComment($removeCommentAttachmentCommand); }