13 use PHPUnit_Framework_MockObject_MockObject as MockObject;
23 private $paymentDOMock;
38 private $subjectReaderMock;
42 $this->paymentDOMock = $this->createMock(PaymentDataObjectInterface::class);
43 $this->orderMock = $this->createMock(OrderAdapterInterface::class);
44 $this->subjectReaderMock = $this->getMockBuilder(SubjectReader::class)
45 ->disableOriginalConstructor()
60 $this->subjectReaderMock->expects(self::once())
61 ->method(
'readPayment')
63 ->willThrowException(
new \InvalidArgumentException());
65 $this->builder->build($buildSubject);
78 $this->paymentDOMock->expects(static::once())
80 ->willReturn($this->orderMock);
81 $this->orderMock->expects(static::once())
82 ->method(
'getBillingAddress')
83 ->willReturn($billingMock);
86 'payment' => $this->paymentDOMock,
89 $this->subjectReaderMock->expects(self::once())
90 ->method(
'readPayment')
92 ->willReturn($this->paymentDOMock);
94 self::assertEquals($expectedResult, $this->builder->build($buildSubject));
105 'first_name' =>
'John',
106 'last_name' =>
'Smith',
107 'company' =>
'Magento',
108 'phone' =>
'555-555-555',
130 $addressMock = $this->createMock(AddressAdapterInterface::class);
132 $addressMock->expects(static::once())
133 ->method(
'getFirstname')
135 $addressMock->expects(static::once())
136 ->method(
'getLastname')
138 $addressMock->expects(static::once())
139 ->method(
'getCompany')
141 $addressMock->expects(static::once())
142 ->method(
'getTelephone')
144 $addressMock->expects(static::once())
testBuild($billingData, $expectedResult)
testBuildReadPaymentException()