@@ -40,6 +40,11 @@ class BillingAddressManagementTest extends \PHPUnit_Framework_TestCase
40
40
*/
41
41
protected $ addressRepository ;
42
42
43
+ /**
44
+ * @var \PHPUnit_Framework_MockObject_MockObject
45
+ */
46
+ private $ shippingAssignmentMock ;
47
+
43
48
/**
44
49
* @return void
45
50
*/
@@ -59,6 +64,19 @@ protected function setUp()
59
64
'addressRepository ' => $ this ->addressRepository
60
65
]
61
66
);
67
+
68
+ $ this ->shippingAssignmentMock = $ this ->getMock (
69
+ \Magento \Quote \Model \ShippingAddressAssignment::class,
70
+ ['setAddress ' ],
71
+ [],
72
+ '' ,
73
+ false
74
+ );
75
+ $ this ->objectManager ->setBackwardCompatibleProperty (
76
+ $ this ->model ,
77
+ 'shippingAddressAssignment ' ,
78
+ $ this ->shippingAssignmentMock
79
+ );
62
80
}
63
81
64
82
/**
@@ -111,6 +129,10 @@ public function testSetAddress()
111
129
$ quoteMock ->expects ($ this ->once ())->method ('setBillingAddress ' )->with ($ address )->willReturnSelf ();
112
130
$ quoteMock ->expects ($ this ->once ())->method ('setDataChanges ' )->with (1 )->willReturnSelf ();
113
131
132
+ $ this ->shippingAssignmentMock ->expects ($ this ->once ())
133
+ ->method ('setAddress ' )
134
+ ->with ($ quoteMock , $ address , $ useForShipping );
135
+
114
136
$ this ->quoteRepositoryMock ->expects ($ this ->once ())->method ('save ' )->with ($ quoteMock );
115
137
$ this ->assertEquals ($ addressId , $ this ->model ->assign ($ cartId , $ address , $ useForShipping ));
116
138
}
@@ -151,6 +173,10 @@ public function testSetAddressWithInabilityToSaveQuote()
151
173
$ quoteMock ->expects ($ this ->once ())->method ('setBillingAddress ' )->with ($ address )->willReturnSelf ();
152
174
$ quoteMock ->expects ($ this ->once ())->method ('setDataChanges ' )->with (1 )->willReturnSelf ();
153
175
176
+ $ this ->shippingAssignmentMock ->expects ($ this ->once ())
177
+ ->method ('setAddress ' )
178
+ ->with ($ quoteMock , $ address , false );
179
+
154
180
$ this ->quoteRepositoryMock ->expects ($ this ->once ())
155
181
->method ('save ' )
156
182
->with ($ quoteMock )
0 commit comments