public function testProcessRelation() { $this->addressHandlerMock->expects($this->once())->method('removeEmptyAddresses')->with($this->orderMock)->willReturnSelf(); $this->addressHandlerMock->expects($this->once())->method('process')->with($this->orderMock)->willReturnSelf(); $this->orderMock->expects($this->exactly(2))->method('getItems')->willReturn([$this->orderItemMock]); $this->orderMock->expects($this->exactly(3))->method('getId')->willReturn('order-id-value'); $this->orderItemMock->expects($this->once())->method('setOrderId')->with('order-id-value')->willReturnSelf(); $this->orderItemMock->expects($this->once())->method('setOrder')->with($this->orderMock)->willReturnSelf(); $this->orderItemRepositoryMock->expects($this->once())->method('save')->with($this->orderItemMock)->willReturnSelf(); $this->orderMock->expects($this->exactly(2))->method('getPayment')->willReturn($this->orderPaymentMock); $this->orderPaymentMock->expects($this->once())->method('setParentId')->with('order-id-value')->willReturnSelf(); $this->orderPaymentMock->expects($this->once())->method('setOrder')->with($this->orderMock)->willReturnSelf(); $this->orderPaymentResourceMock->expects($this->once())->method('save')->with($this->orderPaymentMock)->willReturnSelf(); $this->orderMock->expects($this->exactly(2))->method('getStatusHistories')->willReturn([$this->orderStatusHistoryMock]); $this->orderStatusHistoryMock->expects($this->once())->method('setParentId')->with('order-id-value')->willReturnSelf(); $this->orderStatusHistoryMock->expects($this->once())->method('setOrder')->with($this->orderMock)->willReturnSelf(); $this->statusHistoryResource->expects($this->once())->method('save')->with($this->orderStatusHistoryMock)->willReturnSelf(); $this->orderMock->expects($this->exactly(2))->method('getRelatedObjects')->willReturn([$this->orderInvoiceMock]); $this->orderInvoiceMock->expects($this->once())->method('setOrder')->with($this->orderMock)->willReturnSelf(); $this->orderInvoiceMock->expects($this->once())->method('save')->willReturnSelf(); $this->relationProcessor->processRelation($this->orderMock); }