Skip to content

Commit b0ad00b

Browse files
committed
MAGETWO-59871: [GITHUB] Updating customer via REST API without address unsets default billing and default shipping address #7380
- fixed static
1 parent 40b9d02 commit b0ad00b

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,10 @@ public function save(\Magento\Customer\Api\Data\CustomerInterface $customer, $pa
146146
{
147147
$prevCustomerData = null;
148148
$prevCustomerDataArr = null;
149-
150149
if ($customer->getId()) {
151150
$prevCustomerData = $this->getById($customer->getId());
152151
$prevCustomerDataArr = $prevCustomerData->__toArray();
153152
}
154-
155153
/** @var $customer \Magento\Customer\Model\Data\Customer */
156154
$customerArr = $customer->__toArray();
157155
$customer = $this->imageProcessor->save(
@@ -191,7 +189,6 @@ public function save(\Magento\Customer\Api\Data\CustomerInterface $customer, $pa
191189
$customerModel->setRpToken(null);
192190
$customerModel->setRpTokenCreatedAt(null);
193191
}
194-
195192
if (!array_key_exists('default_billing', $customerArr) &&
196193
null !== $prevCustomerDataArr &&
197194
array_key_exists('default_billing', $prevCustomerDataArr)

app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,29 +101,22 @@ protected function setUp()
101101
$this->getMock(\Magento\Customer\Model\ResourceModel\Customer::class, [], [], '', false);
102102
$this->customerRegistry = $this->getMock(\Magento\Customer\Model\CustomerRegistry::class, [], [], '', false);
103103
$this->dataObjectHelper = $this->getMock(\Magento\Framework\Api\DataObjectHelper::class, [], [], '', false);
104-
$this->customerFactory = $this->getMock(
105-
\Magento\Customer\Model\CustomerFactory::class,
106-
['create'],
107-
[],
108-
'',
109-
false
110-
);
104+
$this->customerFactory =
105+
$this->getMock(\Magento\Customer\Model\CustomerFactory::class, ['create'], [], '', false);
111106
$this->customerSecureFactory = $this->getMock(
112107
\Magento\Customer\Model\Data\CustomerSecureFactory::class,
113108
['create'],
114109
[],
115110
'',
116111
false
117112
);
118-
119113
$this->addressRepository = $this->getMock(
120114
\Magento\Customer\Model\ResourceModel\AddressRepository::class,
121115
[],
122116
[],
123117
'',
124118
false
125119
);
126-
127120
$this->customerMetadata = $this->getMockForAbstractClass(
128121
\Magento\Customer\Api\CustomerMetadataInterface::class,
129122
[],
@@ -179,10 +172,8 @@ protected function setUp()
179172
'__toArray'
180173
]
181174
);
182-
183175
$this->collectionProcessorMock = $this->getMockBuilder(CollectionProcessorInterface::class)
184176
->getMock();
185-
186177
$this->model = new \Magento\Customer\Model\ResourceModel\CustomerRepository(
187178
$this->customerFactory,
188179
$this->customerSecureFactory,

0 commit comments

Comments
 (0)