|
5 | 5 | */
|
6 | 6 | namespace Magento\Paypal\Test\Unit\Model\Hostedpro;
|
7 | 7 |
|
| 8 | +use Magento\Framework\DataObject; |
8 | 9 | use Magento\Sales\Model\Order;
|
9 | 10 | use Magento\Sales\Model\Order\Payment;
|
10 | 11 |
|
@@ -47,75 +48,82 @@ protected function setUp()
|
47 | 48 | }
|
48 | 49 |
|
49 | 50 | /**
|
| 51 | + * @param $billing |
| 52 | + * @param $shipping |
| 53 | + * @param $billingState |
| 54 | + * @param $state |
| 55 | + * @param $countryId |
50 | 56 | * @dataProvider addressesDataProvider
|
51 | 57 | */
|
52 |
| - public function testSetOrderAddresses($billing, $shipping, $billingState, $state) |
| 58 | + public function testSetOrderAddresses($billing, $shipping, $billingState, $state, $countryId) |
53 | 59 | {
|
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()) |
63 | 69 | ->method('getPayment')
|
64 | 70 | ->will($this->returnValue($payment));
|
65 |
| - $order->expects($this->any()) |
| 71 | + $order->expects(static::any()) |
66 | 72 | ->method('getBillingAddress')
|
67 | 73 | ->will($this->returnValue($billing));
|
68 |
| - $order->expects($this->any()) |
| 74 | + $order->expects(static::any()) |
69 | 75 | ->method('getShippingAddress')
|
70 | 76 | ->will($this->returnValue($shipping));
|
71 | 77 | $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')); |
74 | 82 | }
|
75 | 83 |
|
76 | 84 | /**
|
77 | 85 | * @return array
|
78 | 86 | */
|
79 | 87 | public function addressesDataProvider()
|
80 | 88 | {
|
81 |
| - $billing = new \Magento\Framework\DataObject([ |
| 89 | + $billing = new DataObject([ |
82 | 90 | 'firstname' => 'Firstname',
|
83 | 91 | 'lastname' => 'Lastname',
|
84 | 92 | 'city' => 'City',
|
85 | 93 | 'region_code' => 'CA',
|
86 | 94 | 'postcode' => '12346',
|
87 |
| - 'country' => 'United States', |
88 |
| - 'Street' => '1 Ln Ave', |
| 95 | + 'country_id' => 'US', |
| 96 | + 'street' => '1 Ln Ave', |
89 | 97 | ]);
|
90 |
| - $shipping = new \Magento\Framework\DataObject([ |
| 98 | + $shipping = new DataObject([ |
91 | 99 | 'firstname' => 'ShipFirstname',
|
92 | 100 | 'lastname' => 'ShipLastname',
|
93 | 101 | 'city' => 'ShipCity',
|
94 | 102 | 'region' => 'olala',
|
95 | 103 | 'postcode' => '12346',
|
96 |
| - 'country' => 'United States', |
97 |
| - 'Street' => '1 Ln Ave', |
| 104 | + 'country_id' => 'US', |
| 105 | + 'street' => '1 Ln Ave', |
98 | 106 | ]);
|
99 |
| - $billing2 = new \Magento\Framework\DataObject([ |
| 107 | + $billing2 = new DataObject([ |
100 | 108 | 'firstname' => 'Firstname',
|
101 | 109 | 'lastname' => 'Lastname',
|
102 |
| - 'city' => 'City', |
103 |
| - 'region_code' => 'muuuu', |
| 110 | + 'city' => 'Culver City', |
| 111 | + 'region_code' => 'CA', |
104 | 112 | 'postcode' => '12346',
|
105 |
| - 'country' => 'United States', |
106 |
| - 'Street' => '1 Ln Ave', |
| 113 | + 'country_id' => 'US', |
| 114 | + 'street' => '1 Ln Ave', |
107 | 115 | ]);
|
108 |
| - $shipping2 = new \Magento\Framework\DataObject([ |
| 116 | + $shipping2 = new DataObject([ |
109 | 117 | 'firstname' => 'ShipFirstname',
|
110 | 118 | 'lastname' => 'ShipLastname',
|
111 | 119 | 'city' => 'ShipCity',
|
112 | 120 | 'postcode' => '12346',
|
113 |
| - 'country' => 'United States', |
114 |
| - 'Street' => '1 Ln Ave', |
| 121 | + 'country_id' => 'US', |
| 122 | + 'street' => '1 Ln Ave', |
115 | 123 | ]);
|
116 | 124 | return [
|
117 |
| - [$billing, $shipping, 'CA', 'olala'], |
118 |
| - [$billing2, $shipping2, 'muuuu', 'ShipCity'] |
| 125 | + [$billing, $shipping, 'CA', 'olala', 'US'], |
| 126 | + [$billing2, $shipping2, 'CA', 'ShipCity', 'US'] |
119 | 127 | ];
|
120 | 128 | }
|
121 | 129 |
|
|
0 commit comments