88namespace Magento \Customer \Controller \Adminhtml \Index ;
99
1010use Magento \Backend \Model \Session ;
11+ use Magento \Customer \Api \CustomerMetadataInterface ;
1112use Magento \Customer \Api \CustomerNameGenerationInterface ;
1213use Magento \Customer \Api \CustomerRepositoryInterface ;
1314use Magento \Customer \Api \Data \CustomerInterface ;
1415use Magento \Customer \Model \Data \Customer as CustomerData ;
1516use Magento \Customer \Model \EmailNotification ;
17+ use Magento \Eav \Api \AttributeRepositoryInterface ;
1618use Magento \Framework \App \Area ;
1719use Magento \Framework \App \Request \Http as HttpRequest ;
1820use Magento \Framework \Locale \ResolverInterface ;
2325use Magento \Newsletter \Model \SubscriberFactory ;
2426use Magento \Store \Model \Store ;
2527use Magento \Store \Model \StoreManagerInterface ;
28+ use Magento \TestFramework \Helper \Bootstrap ;
2629use Magento \TestFramework \TestCase \AbstractBackendController ;
2730use PHPUnit \Framework \MockObject \MockObject ;
2831
@@ -458,14 +461,13 @@ public function testCreateCustomerByAdminWithLocaleGB(): void
458461 [
459462 'customer ' => [
460463 CustomerData::DOB => '1990-10-24 ' ,
461- CustomerData::GENDER => '0 ' ,
462464 ],
463465 ]
464466 );
465467 unset($ expectedData ['customer ' ]['sendemail_store_id ' ]);
466468 $ this ->dispatchCustomerSave ($ postData );
467469 $ this ->assertSessionMessages (
468- $ this ->equalTo ([ (string )__ ('You saved the customer. ' )] ),
470+ $ this ->containsEqual ( (string )__ ('You saved the customer. ' )),
469471 MessageInterface::TYPE_SUCCESS
470472 );
471473 $ this ->assertRedirect ($ this ->stringContains ($ this ->baseControllerUrl . 'index/key/ ' ));
@@ -496,7 +498,8 @@ private function getDefaultCustomerData(): array
496498 CustomerData::EMAIL => 'janedoe ' . uniqid () . '@example.com ' ,
497499 CustomerData::DOB => '01/01/2000 ' ,
498500 CustomerData::TAXVAT => '121212 ' ,
499- CustomerData::GENDER => 'Male ' ,
501+ CustomerData::GENDER => Bootstrap::getObjectManager ()->get (AttributeRepositoryInterface::class)
502+ ->get (CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER , 'gender ' )->getSource ()->getOptionId ('Male ' ),
500503 'sendemail_store_id ' => '1 ' ,
501504 ]
502505 ];
@@ -516,7 +519,6 @@ private function getExpectedCustomerData(array $defaultCustomerData): array
516519 [
517520 'customer ' => [
518521 CustomerData::DOB => '2000-01-01 ' ,
519- CustomerData::GENDER => '0 ' ,
520522 CustomerData::STORE_ID => 1 ,
521523 CustomerData::CREATED_IN => 'Default Store View ' ,
522524 ],
0 commit comments