File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed
app/code/Magento/Customer Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -342,21 +342,25 @@ public function _construct()
342
342
public function getDataModel ()
343
343
{
344
344
$ customerData = $ this ->getData ();
345
- $ addressesData = [];
345
+ $ regularAddresses = $ defaultAddresses = [];
346
346
/** @var \Magento\Customer\Model\Address $address */
347
347
foreach ($ this ->getAddresses () as $ address ) {
348
348
if (!isset ($ this ->storedAddress [$ address ->getId ()])) {
349
349
$ this ->storedAddress [$ address ->getId ()] = $ address ->getDataModel ();
350
350
}
351
- $ addressesData [] = $ this ->storedAddress [$ address ->getId ()];
351
+ if ($ this ->storedAddress [$ address ->getId ()]->isDefaultShipping ()) {
352
+ $ defaultAddresses [] = $ this ->storedAddress [$ address ->getId ()];
353
+ } else {
354
+ $ regularAddresses [] = $ this ->storedAddress [$ address ->getId ()];
355
+ }
352
356
}
353
357
$ customerDataObject = $ this ->customerDataFactory ->create ();
354
358
$ this ->dataObjectHelper ->populateWithArray (
355
359
$ customerDataObject ,
356
360
$ customerData ,
357
361
\Magento \Customer \Api \Data \CustomerInterface::class
358
362
);
359
- $ customerDataObject ->setAddresses ($ addressesData )
363
+ $ customerDataObject ->setAddresses (array_merge ( $ defaultAddresses , $ regularAddresses ) )
360
364
->setId ($ this ->getId ());
361
365
return $ customerDataObject ;
362
366
}
Original file line number Diff line number Diff line change 1
1
<?php declare (strict_types=1 );
2
- /**
3
- * Unit test for customer service layer \Magento\Customer\Model\Customer
2
+ /************************************************************************
3
+ *
4
+ * Copyright 2023 Adobe
5
+ * All Rights Reserved.
4
6
*
5
- * Copyright © Magento, Inc. All rights reserved.
6
- * See COPYING.txt for license details.
7
+ * NOTICE: All information contained herein is, and remains
8
+ * the property of Adobe and its suppliers, if any. The intellectual
9
+ * and technical concepts contained herein are proprietary to Adobe
10
+ * and its suppliers and are protected by all applicable intellectual
11
+ * property laws, including trade secret and copyright laws.
12
+ * Dissemination of this information or reproduction of this material
13
+ * is strictly forbidden unless prior written permission is obtained
14
+ * from Adobe.
15
+ * ************************************************************************
7
16
*/
8
17
9
18
/**
@@ -387,6 +396,7 @@ public function testGetDataModel()
387
396
$ this ->_model ->setEntityId ($ customerId );
388
397
$ this ->_model ->setId ($ customerId );
389
398
$ addressDataModel = $ this ->getMockForAbstractClass (AddressInterface::class);
399
+ $ addressDataModel ->expects ($ this ->exactly (4 ))->method ('isDefaultShipping ' )->willReturn (true );
390
400
$ address = $ this ->getMockBuilder (AddressModel::class)
391
401
->disableOriginalConstructor ()
392
402
->setMethods (['setCustomer ' , 'getDataModel ' ])
You can’t perform that action at this time.
0 commit comments