public function testAddComment() { $this->orderRepositoryMock->expects($this->once())->method('get')->with(123)->willReturn($this->orderMock); $this->orderMock->expects($this->once())->method('addStatusHistory')->with($this->orderStatusHistoryMock)->willReturn($this->orderMock); $this->orderRepositoryMock->expects($this->once())->method('save')->with($this->orderMock)->willReturn([]); $this->assertTrue($this->orderService->addComment(123, $this->orderStatusHistoryMock)); }
public function testAddComment() { $clearComment = "Comment text here..."; $this->orderRepositoryMock->expects($this->once())->method('get')->with(123)->willReturn($this->orderMock); $this->orderMock->expects($this->once())->method('addStatusHistory')->with($this->orderStatusHistoryMock)->willReturn($this->orderMock); $this->orderStatusHistoryMock->expects($this->once())->method('getComment')->willReturn("<h1>" . $clearComment); $this->orderRepositoryMock->expects($this->once())->method('save')->with($this->orderMock)->willReturn([]); $this->orderCommentSender->expects($this->once())->method('send')->with($this->orderMock, false, $clearComment); $this->assertTrue($this->orderService->addComment(123, $this->orderStatusHistoryMock)); }