public function testBuildWithSwitchedOffVault() { $expectedResult = []; $buildSubject = []; $this->vaultPaymentMock->expects(self::once())->method('isActiveForPayment')->willReturn(false); static::assertEquals($expectedResult, $this->builder->build($buildSubject)); }
public function testBuild() { $additionalData = [[DataAssignObserver::PAYMENT_METHOD_NONCE, self::PAYMENT_METHOD_NONCE]]; $expectedResult = [PaymentDataBuilder::AMOUNT => 10.0, PaymentDataBuilder::PAYMENT_METHOD_NONCE => self::PAYMENT_METHOD_NONCE, PaymentDataBuilder::MERCHANT_ACCOUNT_ID => self::MERCHANT_ACCOUNT_ID]; $buildSubject = ['payment' => $this->paymentDO, 'amount' => 10.0]; $this->paymentMock->expects(static::exactly(count($additionalData)))->method('getAdditionalInformation')->willReturnMap($additionalData); $this->configMock->expects(static::once())->method('getValue')->with(Config::KEY_MERCHANT_ACCOUNT_ID)->willReturn(self::MERCHANT_ACCOUNT_ID); $this->paymentDO->expects(static::once())->method('getPayment')->willReturn($this->paymentMock); $this->subjectReaderMock->expects(self::once())->method('readPayment')->with($buildSubject)->willReturn($this->paymentDO); $this->subjectReaderMock->expects(self::once())->method('readAmount')->with($buildSubject)->willReturn(10.0); static::assertEquals($expectedResult, $this->builder->build($buildSubject)); }