3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+ declare (strict_types=1 );
6
7
7
8
namespace Magento \Customer \Api ;
8
9
@@ -142,7 +143,7 @@ protected function tearDown(): void
142
143
}
143
144
144
145
/**
145
- * Validate update by invalid customer.
146
+ * Validate update operation by invalid customer
146
147
*
147
148
*/
148
149
public function testInvalidCustomerUpdate ()
@@ -152,9 +153,8 @@ public function testInvalidCustomerUpdate()
152
153
//Create first customer and retrieve customer token.
153
154
$ firstCustomerData = $ this ->_createCustomer ();
154
155
155
- // get customer ID token
156
+ //Get customer ID token
156
157
/** @var \Magento\Integration\Api\CustomerTokenServiceInterface $customerTokenService */
157
- //$customerTokenService = $this->objectManager->create(CustomerTokenServiceInterface::class);
158
158
$ customerTokenService = Bootstrap::getObjectManager ()->create (
159
159
\Magento \Integration \Api \CustomerTokenServiceInterface::class
160
160
);
@@ -238,11 +238,9 @@ public function testDeleteCustomer()
238
238
'operation ' => self ::SERVICE_NAME . 'DeleteById ' ,
239
239
],
240
240
];
241
- if (TESTS_WEB_API_ADAPTER == self ::ADAPTER_SOAP ) {
242
- $ response = $ this ->_webApiCall ($ serviceInfo , ['customerId ' => $ customerData ['id ' ]]);
243
- } else {
244
- $ response = $ this ->_webApiCall ($ serviceInfo );
245
- }
241
+ $ response = (TESTS_WEB_API_ADAPTER === self ::ADAPTER_SOAP )
242
+ ? $ this ->_webApiCall ($ serviceInfo , ['customerId ' => $ customerData ['id ' ]])
243
+ : $ this ->_webApiCall ($ serviceInfo );
246
244
247
245
$ this ->assertTrue ($ response );
248
246
@@ -253,7 +251,7 @@ public function testDeleteCustomer()
253
251
}
254
252
255
253
/**
256
- * Check that non authorized consumer can`t delete customer.
254
+ * Check that non- authorized consumer can`t delete customer.
257
255
*
258
256
* @return void
259
257
*/
@@ -347,10 +345,10 @@ public function testDeleteCustomerInvalidCustomerId(): void
347
345
public function testUpdateCustomer (): void
348
346
{
349
347
$ customerId = 1 ;
350
- $ updatedLastname = 'Updated lastname ' ;
348
+ $ updatedLastName = 'Updated lastname ' ;
351
349
$ customer = $ this ->getCustomerData ($ customerId );
352
350
$ customerData = $ this ->dataObjectProcessor ->buildOutputDataArray ($ customer , Customer::class);
353
- $ customerData [Customer::LASTNAME ] = $ updatedLastname ;
351
+ $ customerData [Customer::LASTNAME ] = $ updatedLastName ;
354
352
355
353
$ serviceInfo = [
356
354
'rest ' => [
@@ -364,16 +362,20 @@ public function testUpdateCustomer(): void
364
362
],
365
363
];
366
364
367
- $ requestData ['customer ' ] = TESTS_WEB_API_ADAPTER === self ::ADAPTER_SOAP
365
+ $ requestData ['customer ' ] = ( TESTS_WEB_API_ADAPTER === self ::ADAPTER_SOAP )
368
366
? $ customerData
369
- : [Customer::LASTNAME => $ updatedLastname ];
370
-
367
+ : [
368
+ Customer::FIRSTNAME => $ customer ->getFirstname (),
369
+ Customer::LASTNAME => $ updatedLastName ,
370
+ Customer::EMAIL => $ customer ->getEmail (),
371
+ Customer::ID => $ customerId ,
372
+ ];
371
373
$ response = $ this ->_webApiCall ($ serviceInfo , $ requestData );
372
374
$ this ->assertNotNull ($ response );
373
375
374
376
//Verify if the customer is updated
375
377
$ existingCustomerDataObject = $ this ->getCustomerData ($ customerId );
376
- $ this ->assertEquals ($ updatedLastname , $ existingCustomerDataObject ->getLastname ());
378
+ $ this ->assertEquals ($ updatedLastName , $ existingCustomerDataObject ->getLastname ());
377
379
$ this ->assertEquals ($ customerData [Customer::FIRSTNAME ], $ existingCustomerDataObject ->getFirstname ());
378
380
}
379
381
0 commit comments