15 use PHPUnit_Framework_MockObject_MockObject as MockObject;
42 private $paymentDOMock;
47 private $subjectReaderMock;
51 $this->paymentDOMock = $this->createMock(PaymentDataObjectInterface::class);
52 $this->configMock = $this->getMockBuilder(Config::class)
53 ->disableOriginalConstructor()
55 $this->paymentMock = $this->getMockBuilder(Payment::class)
56 ->disableOriginalConstructor()
58 $this->subjectReaderMock = $this->getMockBuilder(SubjectReader::class)
59 ->disableOriginalConstructor()
72 $this->configMock->expects(self::never())
73 ->method(
'hasFraudProtection')
76 $this->subjectReaderMock->expects(self::once())
77 ->method(
'readPayment')
79 ->willThrowException(
new \InvalidArgumentException());
81 $this->builder->build($buildSubject);
94 $order = $this->createMock(OrderAdapterInterface::class);
95 $this->paymentDOMock->expects(self::once())->method(
'getOrder')->willReturn(
$order);
97 $buildSubject = [
'payment' => $this->paymentDOMock];
99 $this->paymentMock->expects(self::exactly(count($additionalData)))
100 ->method(
'getAdditionalInformation')
101 ->willReturn($additionalData);
103 $this->configMock->expects(self::once())
104 ->method(
'hasFraudProtection')
107 $this->paymentDOMock->expects(self::once())
108 ->method(
'getPayment')
109 ->willReturn($this->paymentMock);
111 $this->subjectReaderMock->expects(self::once())
112 ->method(
'readPayment')
113 ->with($buildSubject)
114 ->willReturn($this->paymentDOMock);
116 static::assertEquals(
118 $this->builder->build($buildSubject)
testBuildReadPaymentException()