Skip to content

Commit cb6f243

Browse files
committed
Merge remote-tracking branch 'mpi/MAGETWO-45261' into PR
2 parents 93db0c8 + 63f6423 commit cb6f243

File tree

2 files changed

+40
-32
lines changed

2 files changed

+40
-32
lines changed

app/code/Magento/Paypal/Model/Hostedpro/Request.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ protected function _getShippingAddress(\Magento\Framework\DataObject $address)
267267
'city' => $address->getCity(),
268268
'state' => $region ? $region : $address->getCity(),
269269
'zip' => $address->getPostcode(),
270-
'country' => $address->getCountry(),
270+
'country' => $address->getCountryId(),
271271
];
272272

273273
// convert streets to tow lines format
@@ -295,7 +295,7 @@ protected function _getBillingAddress(\Magento\Framework\DataObject $address)
295295
'billing_city' => $address->getCity(),
296296
'billing_state' => $region ? $region : $address->getCity(),
297297
'billing_zip' => $address->getPostcode(),
298-
'billing_country' => $address->getCountry(),
298+
'billing_country' => $address->getCountryId(),
299299
];
300300

301301
// convert streets to tow lines format

app/code/Magento/Paypal/Test/Unit/Model/Hostedpro/RequestTest.php

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Paypal\Test\Unit\Model\Hostedpro;
77

8+
use Magento\Framework\DataObject;
89
use Magento\Sales\Model\Order;
910
use Magento\Sales\Model\Order\Payment;
1011

@@ -47,75 +48,82 @@ protected function setUp()
4748
}
4849

4950
/**
51+
* @param $billing
52+
* @param $shipping
53+
* @param $billingState
54+
* @param $state
55+
* @param $countryId
5056
* @dataProvider addressesDataProvider
5157
*/
52-
public function testSetOrderAddresses($billing, $shipping, $billingState, $state)
58+
public function testSetOrderAddresses($billing, $shipping, $billingState, $state, $countryId)
5359
{
54-
$payment = $this->getMock('Magento\Sales\Model\Order\Payment', ['__wakeup'], [], '', false);
55-
$order = $this->getMock(
56-
'Magento\Sales\Model\Order',
57-
['getPayment', '__wakeup', 'getBillingAddress', 'getShippingAddress'],
58-
[],
59-
'',
60-
false
61-
);
62-
$order->expects($this->any())
60+
$payment = $this->getMockBuilder(Payment::class)
61+
->disableOriginalConstructor()
62+
->setMethods(['__wakeup'])
63+
->getMock();
64+
$order = $this->getMockBuilder(Order::class)
65+
->disableOriginalConstructor()
66+
->setMethods(['getPayment', '__wakeup', 'getBillingAddress', 'getShippingAddress'])
67+
->getMock();
68+
$order->expects(static::any())
6369
->method('getPayment')
6470
->will($this->returnValue($payment));
65-
$order->expects($this->any())
71+
$order->expects(static::any())
6672
->method('getBillingAddress')
6773
->will($this->returnValue($billing));
68-
$order->expects($this->any())
74+
$order->expects(static::any())
6975
->method('getShippingAddress')
7076
->will($this->returnValue($shipping));
7177
$this->_model->setOrder($order);
72-
$this->assertEquals($billingState, $this->_model->getData('billing_state'));
73-
$this->assertEquals($state, $this->_model->getData('state'));
78+
static::assertEquals($billingState, $this->_model->getData('billing_state'));
79+
static::assertEquals($state, $this->_model->getData('state'));
80+
static::assertEquals($countryId, $this->_model->getData('billing_country'));
81+
static::assertEquals($countryId, $this->_model->getData('country'));
7482
}
7583

7684
/**
7785
* @return array
7886
*/
7987
public function addressesDataProvider()
8088
{
81-
$billing = new \Magento\Framework\DataObject([
89+
$billing = new DataObject([
8290
'firstname' => 'Firstname',
8391
'lastname' => 'Lastname',
8492
'city' => 'City',
8593
'region_code' => 'CA',
8694
'postcode' => '12346',
87-
'country' => 'United States',
88-
'Street' => '1 Ln Ave',
95+
'country_id' => 'US',
96+
'street' => '1 Ln Ave',
8997
]);
90-
$shipping = new \Magento\Framework\DataObject([
98+
$shipping = new DataObject([
9199
'firstname' => 'ShipFirstname',
92100
'lastname' => 'ShipLastname',
93101
'city' => 'ShipCity',
94102
'region' => 'olala',
95103
'postcode' => '12346',
96-
'country' => 'United States',
97-
'Street' => '1 Ln Ave',
104+
'country_id' => 'US',
105+
'street' => '1 Ln Ave',
98106
]);
99-
$billing2 = new \Magento\Framework\DataObject([
107+
$billing2 = new DataObject([
100108
'firstname' => 'Firstname',
101109
'lastname' => 'Lastname',
102-
'city' => 'City',
103-
'region_code' => 'muuuu',
110+
'city' => 'Culver City',
111+
'region_code' => 'CA',
104112
'postcode' => '12346',
105-
'country' => 'United States',
106-
'Street' => '1 Ln Ave',
113+
'country_id' => 'US',
114+
'street' => '1 Ln Ave',
107115
]);
108-
$shipping2 = new \Magento\Framework\DataObject([
116+
$shipping2 = new DataObject([
109117
'firstname' => 'ShipFirstname',
110118
'lastname' => 'ShipLastname',
111119
'city' => 'ShipCity',
112120
'postcode' => '12346',
113-
'country' => 'United States',
114-
'Street' => '1 Ln Ave',
121+
'country_id' => 'US',
122+
'street' => '1 Ln Ave',
115123
]);
116124
return [
117-
[$billing, $shipping, 'CA', 'olala'],
118-
[$billing2, $shipping2, 'muuuu', 'ShipCity']
125+
[$billing, $shipping, 'CA', 'olala', 'US'],
126+
[$billing2, $shipping2, 'CA', 'ShipCity', 'US']
119127
];
120128
}
121129

0 commit comments

Comments
 (0)