File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
app/code/Magento/CustomerImportExport
Model/ResourceModel/Import/Customer
Test/Unit/Model/ResourceModel/Import/Customer Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,11 @@ public function addCustomerByArray(array $customer)
112
112
*/
113
113
public function addCustomer (\Magento \Framework \DataObject $ customer )
114
114
{
115
- $ this ->addCustomerByArray ($ customer ->toArray ());
115
+ $ customerData = $ customer ->toArray ();
116
+ if (!isset ($ customerData ['entity_id ' ]) && isset ($ customer ['id ' ])) {
117
+ $ customerData ['entity_id ' ] = $ customerData ['id ' ];
118
+ }
119
+ $ this ->addCustomerByArray ($ customerData );
116
120
117
121
return $ this ;
118
122
}
Original file line number Diff line number Diff line change @@ -101,6 +101,20 @@ public function testLoad()
101
101
}
102
102
103
103
public function testAddCustomer ()
104
+ {
105
+ $ customer = new \Magento \Framework \DataObject (['id ' => 1 , 'website_id ' => 1 , 'email ' => 'test@test.com ' ]);
106
+ $ this ->_model ->addCustomer ($ customer );
107
+
108
+ $ propertyName = '_customerIds ' ;
109
+ $ this ->assertAttributeCount (1 , $ propertyName , $ this ->_model );
110
+ $ this ->assertAttributeContains ([$ customer ->getWebsiteId () => $ customer ->getId ()], $ propertyName , $ this ->_model );
111
+ $ this ->assertEquals (
112
+ $ customer ->getId (),
113
+ $ this ->_model ->getCustomerId ($ customer ->getEmail (), $ customer ->getWebsiteId ())
114
+ );
115
+ }
116
+
117
+ public function testAddCustomerByArray ()
104
118
{
105
119
$ propertyName = '_customerIds ' ;
106
120
$ customer = $ this ->_addCustomerToStorage ();
You can’t perform that action at this time.
0 commit comments