@@ -86,6 +86,11 @@ class QuoteManagementTest extends \PHPUnit_Framework_TestCase
86
86
*/
87
87
protected $ customerFactoryMock ;
88
88
89
+ /**
90
+ * @var \PHPUnit_Framework_MockObject_MockObject
91
+ */
92
+ protected $ quoteAddressFactory ;
93
+
89
94
/**
90
95
* @var \PHPUnit_Framework_MockObject_MockObject
91
96
*/
@@ -207,6 +212,14 @@ protected function setUp()
207
212
false
208
213
);
209
214
215
+ $ this ->quoteAddressFactory = $ this ->getMock (
216
+ 'Magento\Quote\Model\Quote\AddressFactory ' ,
217
+ ['create ' ],
218
+ [],
219
+ '' ,
220
+ false
221
+ );
222
+
210
223
$ this ->dataObjectHelperMock = $ this ->getMock ('\Magento\Framework\Api\DataObjectHelper ' , [], [], '' , false );
211
224
$ this ->checkoutSessionMock = $ this ->getMock (
212
225
'Magento\Checkout\Model\Session ' ,
@@ -242,6 +255,7 @@ protected function setUp()
242
255
'quoteRepository ' => $ this ->quoteRepositoryMock ,
243
256
'customerRepository ' => $ this ->customerRepositoryMock ,
244
257
'customerModelFactory ' => $ this ->customerFactoryMock ,
258
+ 'quoteAddressFactory ' => $ this ->quoteAddressFactory ,
245
259
'dataObjectHelper ' => $ this ->dataObjectHelperMock ,
246
260
'storeManager ' => $ this ->storeManagerMock ,
247
261
'checkoutSession ' => $ this ->checkoutSessionMock ,
@@ -259,6 +273,13 @@ public function testCreateEmptyCartAnonymous()
259
273
260
274
$ quoteMock = $ this ->getMock ('\Magento\Quote\Model\Quote ' , [], [], '' , false );
261
275
276
+ $ quoteAddress = $ this ->getMock ('\Magento\Quote\Model\Quote\Address ' , [], [], '' , false );
277
+
278
+ $ quoteMock ->expects ($ this ->any ())->method ('setBillingAddress ' )->with ($ quoteAddress )->willReturnSelf ();
279
+ $ quoteMock ->expects ($ this ->any ())->method ('setShippingAddress ' )->with ($ quoteAddress )->willReturnSelf ();
280
+
281
+ $ this ->quoteAddressFactory ->expects ($ this ->any ())->method ('create ' )->willReturn ($ quoteAddress );
282
+
262
283
$ this ->quoteFactoryMock ->expects ($ this ->once ())->method ('create ' )->willReturn ($ quoteMock );
263
284
$ quoteMock ->expects ($ this ->any ())->method ('setStoreId ' )->with ($ storeId );
264
285
@@ -688,6 +709,7 @@ public function testPlaceOrderIfCustomerIsGuest()
688
709
'quoteRepository ' => $ this ->quoteRepositoryMock ,
689
710
'customerRepository ' => $ this ->customerRepositoryMock ,
690
711
'customerModelFactory ' => $ this ->customerFactoryMock ,
712
+ 'quoteAddressFactory ' => $ this ->quoteAddressFactory ,
691
713
'dataObjectHelper ' => $ this ->dataObjectHelperMock ,
692
714
'storeManager ' => $ this ->storeManagerMock ,
693
715
'checkoutSession ' => $ this ->checkoutSessionMock ,
@@ -745,6 +767,7 @@ public function testPlaceOrder()
745
767
'quoteRepository ' => $ this ->quoteRepositoryMock ,
746
768
'customerRepository ' => $ this ->customerRepositoryMock ,
747
769
'customerModelFactory ' => $ this ->customerFactoryMock ,
770
+ 'quoteAddressFactory ' => $ this ->quoteAddressFactory ,
748
771
'dataObjectHelper ' => $ this ->dataObjectHelperMock ,
749
772
'storeManager ' => $ this ->storeManagerMock ,
750
773
'checkoutSession ' => $ this ->checkoutSessionMock ,
0 commit comments