33 * Copyright © Magento, Inc. All rights reserved.
44 * See COPYING.txt for license details.
55 */
6+ declare (strict_types=1 );
67
78namespace Magento \Customer \Api ;
89
@@ -142,7 +143,7 @@ protected function tearDown(): void
142143 }
143144
144145 /**
145- * Validate update by invalid customer.
146+ * Validate update operation by invalid customer
146147 *
147148 */
148149 public function testInvalidCustomerUpdate ()
@@ -152,9 +153,8 @@ public function testInvalidCustomerUpdate()
152153 //Create first customer and retrieve customer token.
153154 $ firstCustomerData = $ this ->_createCustomer ();
154155
155- // get customer ID token
156+ //Get customer ID token
156157 /** @var \Magento\Integration\Api\CustomerTokenServiceInterface $customerTokenService */
157- //$customerTokenService = $this->objectManager->create(CustomerTokenServiceInterface::class);
158158 $ customerTokenService = Bootstrap::getObjectManager ()->create (
159159 \Magento \Integration \Api \CustomerTokenServiceInterface::class
160160 );
@@ -238,11 +238,9 @@ public function testDeleteCustomer()
238238 'operation ' => self ::SERVICE_NAME . 'DeleteById ' ,
239239 ],
240240 ];
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 );
246244
247245 $ this ->assertTrue ($ response );
248246
@@ -253,7 +251,7 @@ public function testDeleteCustomer()
253251 }
254252
255253 /**
256- * Check that non authorized consumer can`t delete customer.
254+ * Check that non- authorized consumer can`t delete customer.
257255 *
258256 * @return void
259257 */
@@ -347,10 +345,10 @@ public function testDeleteCustomerInvalidCustomerId(): void
347345 public function testUpdateCustomer (): void
348346 {
349347 $ customerId = 1 ;
350- $ updatedLastname = 'Updated lastname ' ;
348+ $ updatedLastName = 'Updated lastname ' ;
351349 $ customer = $ this ->getCustomerData ($ customerId );
352350 $ customerData = $ this ->dataObjectProcessor ->buildOutputDataArray ($ customer , Customer::class);
353- $ customerData [Customer::LASTNAME ] = $ updatedLastname ;
351+ $ customerData [Customer::LASTNAME ] = $ updatedLastName ;
354352
355353 $ serviceInfo = [
356354 'rest ' => [
@@ -364,16 +362,20 @@ public function testUpdateCustomer(): void
364362 ],
365363 ];
366364
367- $ requestData ['customer ' ] = TESTS_WEB_API_ADAPTER === self ::ADAPTER_SOAP
365+ $ requestData ['customer ' ] = ( TESTS_WEB_API_ADAPTER === self ::ADAPTER_SOAP )
368366 ? $ 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+ ];
371373 $ response = $ this ->_webApiCall ($ serviceInfo , $ requestData );
372374 $ this ->assertNotNull ($ response );
373375
374376 //Verify if the customer is updated
375377 $ existingCustomerDataObject = $ this ->getCustomerData ($ customerId );
376- $ this ->assertEquals ($ updatedLastname , $ existingCustomerDataObject ->getLastname ());
378+ $ this ->assertEquals ($ updatedLastName , $ existingCustomerDataObject ->getLastname ());
377379 $ this ->assertEquals ($ customerData [Customer::FIRSTNAME ], $ existingCustomerDataObject ->getFirstname ());
378380 }
379381
0 commit comments