File tree 2 files changed +2
-11
lines changed
Observer/Frontend/Quote/Address
Test/Unit/Observer/Frontend/Quote/Address
2 files changed +2
-11
lines changed Original file line number Diff line number Diff line change @@ -119,9 +119,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
119
119
120
120
$ groupId = null ;
121
121
if (empty ($ customerVatNumber ) || false == $ this ->customerVat ->isCountryInEU ($ customerCountryCode )) {
122
- $ groupId = $ customer ->getId () ? $ this ->groupManagement ->getDefaultGroup (
123
- $ storeId
124
- )->getId () : $ this ->groupManagement ->getNotLoggedInGroup ()->getId ();
122
+ $ groupId = $ customer ->getId () ? $ quote ->getCustomerGroupId () : $ this ->groupManagement ->getNotLoggedInGroup ()->getId ();
125
123
} else {
126
124
// Magento always has to emulate group even if customer uses default billing/shipping address
127
125
$ groupId = $ this ->customerVat ->getCustomerGroupIdBasedOnVatNumber (
Original file line number Diff line number Diff line change @@ -243,26 +243,19 @@ public function testDispatchWithDefaultCustomerGroupId()
243
243
->will ($ this ->returnValue ('customerCountryCode ' ));
244
244
$ this ->quoteAddressMock ->expects ($ this ->once ())->method ('getVatId ' )->will ($ this ->returnValue (null ));
245
245
246
- $ this ->quoteMock ->expects ($ this ->once ( ))
246
+ $ this ->quoteMock ->expects ($ this ->exactly ( 2 ))
247
247
->method ('getCustomerGroupId ' )
248
248
->will ($ this ->returnValue ('customerGroupId ' ));
249
249
$ this ->customerMock ->expects ($ this ->once ())->method ('getId ' )->will ($ this ->returnValue ('1 ' ));
250
- $ this ->groupManagementMock ->expects ($ this ->once ())
251
- ->method ('getDefaultGroup ' )
252
- ->will ($ this ->returnValue ($ this ->groupInterfaceMock ));
253
- $ this ->groupInterfaceMock ->expects ($ this ->once ())
254
- ->method ('getId ' )->will ($ this ->returnValue ('defaultCustomerGroupId ' ));
255
250
/** Assertions */
256
251
$ this ->quoteAddressMock ->expects ($ this ->once ())
257
252
->method ('setPrevQuoteCustomerGroupId ' )
258
253
->with ('customerGroupId ' );
259
- $ this ->quoteMock ->expects ($ this ->once ())->method ('setCustomerGroupId ' )->with ('defaultCustomerGroupId ' );
260
254
$ this ->customerDataFactoryMock ->expects ($ this ->any ())
261
255
->method ('create ' )
262
256
->willReturn ($ this ->customerMock );
263
257
264
258
$ this ->quoteMock ->expects ($ this ->once ())->method ('setCustomer ' )->with ($ this ->customerMock );
265
-
266
259
/** SUT execution */
267
260
$ this ->model ->execute ($ this ->observerMock );
268
261
}
You can’t perform that action at this time.
0 commit comments