8
8
namespace Magento \Customer \Controller \Adminhtml \Index ;
9
9
10
10
use Magento \Backend \Model \Session ;
11
+ use Magento \Customer \Api \CustomerMetadataInterface ;
11
12
use Magento \Customer \Api \CustomerNameGenerationInterface ;
12
13
use Magento \Customer \Api \CustomerRepositoryInterface ;
13
14
use Magento \Customer \Api \Data \CustomerInterface ;
14
15
use Magento \Customer \Model \Data \Customer as CustomerData ;
15
16
use Magento \Customer \Model \EmailNotification ;
17
+ use Magento \Eav \Api \AttributeRepositoryInterface ;
16
18
use Magento \Framework \App \Area ;
17
19
use Magento \Framework \App \Request \Http as HttpRequest ;
18
20
use Magento \Framework \Locale \ResolverInterface ;
23
25
use Magento \Newsletter \Model \SubscriberFactory ;
24
26
use Magento \Store \Model \Store ;
25
27
use Magento \Store \Model \StoreManagerInterface ;
28
+ use Magento \TestFramework \Helper \Bootstrap ;
26
29
use Magento \TestFramework \TestCase \AbstractBackendController ;
27
30
use PHPUnit \Framework \MockObject \MockObject ;
28
31
@@ -458,14 +461,13 @@ public function testCreateCustomerByAdminWithLocaleGB(): void
458
461
[
459
462
'customer ' => [
460
463
CustomerData::DOB => '1990-10-24 ' ,
461
- CustomerData::GENDER => '0 ' ,
462
464
],
463
465
]
464
466
);
465
467
unset($ expectedData ['customer ' ]['sendemail_store_id ' ]);
466
468
$ this ->dispatchCustomerSave ($ postData );
467
469
$ this ->assertSessionMessages (
468
- $ this ->equalTo ([ (string )__ ('You saved the customer. ' )] ),
470
+ $ this ->containsEqual ( (string )__ ('You saved the customer. ' )),
469
471
MessageInterface::TYPE_SUCCESS
470
472
);
471
473
$ this ->assertRedirect ($ this ->stringContains ($ this ->baseControllerUrl . 'index/key/ ' ));
@@ -496,7 +498,8 @@ private function getDefaultCustomerData(): array
496
498
CustomerData::EMAIL => 'janedoe ' . uniqid () . '@example.com ' ,
497
499
CustomerData::DOB => '01/01/2000 ' ,
498
500
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 ' ),
500
503
'sendemail_store_id ' => '1 ' ,
501
504
]
502
505
];
@@ -516,7 +519,6 @@ private function getExpectedCustomerData(array $defaultCustomerData): array
516
519
[
517
520
'customer ' => [
518
521
CustomerData::DOB => '2000-01-01 ' ,
519
- CustomerData::GENDER => '0 ' ,
520
522
CustomerData::STORE_ID => 1 ,
521
523
CustomerData::CREATED_IN => 'Default Store View ' ,
522
524
],
0 commit comments