@@ -44,6 +44,9 @@ class AddressDetailsManagementTest extends \PHPUnit_Framework_TestCase
44
44
*/
45
45
protected $ dataProcessor ;
46
46
47
+ /** @var \Magento\Quote\Model\QuoteRepository|\PHPUnit_Framework_MockObject_MockObject */
48
+ protected $ quoteRepository ;
49
+
47
50
/**
48
51
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
49
52
*/
@@ -58,6 +61,7 @@ protected function setUp()
58
61
$ this ->shippingMethodManagement = $ this ->getMock ('\Magento\Quote\Api\ShippingMethodManagementInterface ' );
59
62
$ this ->addressDetailsFactory = $ this ->getMock ('\Magento\Quote\Model\AddressDetailsFactory ' , [], [], '' , false );
60
63
$ this ->dataProcessor = $ this ->getMock ('\Magento\Quote\Model\AddressAdditionalDataProcessor ' , [], [], '' , false );
64
+ $ this ->quoteRepository = $ this ->getMock ('Magento\Quote\Model\QuoteRepository ' , [], [], '' , false );
61
65
62
66
$ this ->model = $ this ->objectManager ->getObject (
63
67
'Magento\Quote\Model\AddressDetailsManagement ' ,
@@ -67,7 +71,8 @@ protected function setUp()
67
71
'paymentMethodManagement ' => $ this ->paymentMethodManagement ,
68
72
'shippingMethodManagement ' => $ this ->shippingMethodManagement ,
69
73
'addressDetailsFactory ' => $ this ->addressDetailsFactory ,
70
- 'dataProcessor ' => $ this ->dataProcessor
74
+ 'dataProcessor ' => $ this ->dataProcessor ,
75
+ 'quoteRepository ' => $ this ->quoteRepository ,
71
76
]
72
77
);
73
78
}
@@ -125,6 +130,16 @@ public function testSaveAddresses()
125
130
->willReturnSelf ();
126
131
$ this ->dataProcessor ->expects ($ this ->once ())->method ('process ' )->with ($ additionalData );
127
132
128
- $ this ->model ->saveAddresses ($ cartId , $ billingAddressMock , $ shippingAddressMock , $ additionalData );
133
+ $ quote = $ this ->getMock ('Magento\Quote\Model\Quote ' , [], [], '' , false );
134
+ $ quote ->expects ($ this ->once ())
135
+ ->method ('setCheckoutMethod ' )
136
+ ->willReturnSelf ();
137
+
138
+ $ this ->quoteRepository
139
+ ->expects ($ this ->once ())
140
+ ->method ('getActive ' )
141
+ ->willReturn ($ quote );
142
+
143
+ $ this ->model ->saveAddresses ($ cartId , $ billingAddressMock , $ shippingAddressMock , $ additionalData , 'register ' );
129
144
}
130
145
}
0 commit comments