paymentDOMock = $this->createMock(PaymentDataObjectInterface::class); $this->paymentMock = $this->createMock(Payment::class); $this->orderMock = $this->createMock(Order::class); $this->paymentDOMock->method('getPayment') ->willReturn($this->paymentMock); $this->builder = new AcceptFdsDataBuilder(new SubjectReader()); } public function testBuild() { $transactionMock = $this->createMock(Transaction::class); $this->paymentMock->method('getAuthorizationTransaction') ->willReturn($transactionMock); $transactionMock->method('getTxnId') ->willReturn('foo'); $expected = [ 'heldTransactionRequest' => [ 'action' => 'approve', 'refTransId' => 'foo' ] ]; $buildSubject = [ 'payment' => $this->paymentDOMock, ]; $this->assertEquals($expected, $this->builder->build($buildSubject)); } }