paymentDOMock = $this->createMock(PaymentDataObjectInterface::class); $this->paymentMock = $this->createMock(Payment::class); $this->paymentDOMock->method('getPayment') ->willReturn($this->paymentMock); $this->orderMock = $this->createMock(OrderAdapterInterface::class); $this->paymentDOMock->method('getOrder') ->willReturn($this->orderMock); $this->builder = new OrderDataBuilder(new SubjectReader()); } public function testBuild() { $this->orderMock->method('getOrderIncrementId') ->willReturn('10000015'); $expected = [ 'transactionRequest' => [ 'order' => [ 'invoiceNumber' => '10000015' ] ] ]; $buildSubject = [ 'payment' => $this->paymentDOMock, 'order' => $this->orderMock, ]; $this->assertEquals($expected, $this->builder->build($buildSubject)); } }