File tree Expand file tree Collapse file tree 2 files changed +24
-16
lines changed
app/code/Magento/Customer
Plugin/Webapi/Controller/Rest
Test/Unit/Plugin/Webapi/Controller/Rest Expand file tree Collapse file tree 2 files changed +24
-16
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,8 @@ class ValidateCustomerData
2828 */
2929 public function beforeOverride (ParamsOverrider $ subject , array $ inputData , array $ parameters ): array
3030 {
31- if (isset ($ inputData [self :: CUSTOMER_KEY ])) {
32- $ inputData [self :: CUSTOMER_KEY ] = $ this ->validateInputData ($ inputData [self :: CUSTOMER_KEY ]);
31+ if (isset ($ inputData [self ::CUSTOMER_KEY ])) {
32+ $ inputData [self ::CUSTOMER_KEY ] = $ this ->validateInputData ($ inputData [self ::CUSTOMER_KEY ]);
3333 }
3434 return [$ inputData , $ parameters ];
3535 }
@@ -45,7 +45,7 @@ private function validateInputData(array $inputData): array
4545 $ result = [];
4646
4747 $ data = array_filter ($ inputData , function ($ k ) use (&$ result ) {
48- $ key = is_string ($ k ) ? strtolower ($ k ) : $ k ;
48+ $ key = is_string ($ k ) ? strtolower (str_replace ( ' _ ' , "" , $ k ) ) : $ k ;
4949 return !isset ($ result [$ key ]) && ($ result [$ key ] = true );
5050 }, ARRAY_FILTER_USE_KEY );
5151
Original file line number Diff line number Diff line change 88namespace Magento \Customer \Test \Unit \Plugin \Webapi \Controller \Rest ;
99
1010use Exception ;
11- use Magento \Framework \App \ObjectManager ;
1211use Magento \Customer \Plugin \Webapi \Controller \Rest \ValidateCustomerData ;
12+ use Magento \Framework \App \ObjectManager ;
1313use PHPUnit \Framework \TestCase ;
1414use ReflectionClass ;
1515
@@ -75,40 +75,48 @@ public function dataProviderInputData(): array
7575 {
7676 return [
7777 [
78- ['customer ' =>
79- [
78+ ['customer ' => [
8079 'id ' => -1 ,
8180 'Id ' => 1 ,
82- 'name ' =>
83- [
81+ 'name ' => [
8482 'firstName ' => 'Test ' ,
8583 'LastName ' => 'user '
8684 ],
8785 'isHavingOwnHouse ' => 1 ,
88- 'address ' =>
89- [
86+ 'address ' => [
9087 'street ' => '1st Street ' ,
9188 'Street ' => '3rd Street ' ,
9289 'city ' => 'London '
9390 ],
9491 ]
9592 ],
96- ['customer ' =>
97- [
93+ ['customer ' => [
9894 'id ' => -1 ,
99- 'name ' =>
100- [
95+ 'name ' => [
10196 'firstName ' => 'Test ' ,
10297 'LastName ' => 'user '
10398 ],
10499 'isHavingOwnHouse ' => 1 ,
105- 'address ' =>
106- [
100+ 'address ' => [
107101 'street ' => '1st Street ' ,
108102 'city ' => 'London '
109103 ],
110104 ]
111105 ],
106+ ['customer ' => [
107+ 'id ' => -1 ,
108+ '_Id ' => 1 ,
109+ 'name ' => [
110+ 'firstName ' => 'Test ' ,
111+ 'LastName ' => 'user '
112+ ],
113+ 'isHavingOwnHouse ' => 1 ,
114+ 'address ' => [
115+ 'street ' => '1st Street ' ,
116+ 'city ' => 'London '
117+ ],
118+ ]
119+ ],
112120 ]
113121 ];
114122 }
You can’t perform that action at this time.
0 commit comments