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
28
28
*/
29
29
public function beforeOverride (ParamsOverrider $ subject , array $ inputData , array $ parameters ): array
30
30
{
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 ]);
33
33
}
34
34
return [$ inputData , $ parameters ];
35
35
}
@@ -45,7 +45,7 @@ private function validateInputData(array $inputData): array
45
45
$ result = [];
46
46
47
47
$ 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 ;
49
49
return !isset ($ result [$ key ]) && ($ result [$ key ] = true );
50
50
}, ARRAY_FILTER_USE_KEY );
51
51
Original file line number Diff line number Diff line change 8
8
namespace Magento \Customer \Test \Unit \Plugin \Webapi \Controller \Rest ;
9
9
10
10
use Exception ;
11
- use Magento \Framework \App \ObjectManager ;
12
11
use Magento \Customer \Plugin \Webapi \Controller \Rest \ValidateCustomerData ;
12
+ use Magento \Framework \App \ObjectManager ;
13
13
use PHPUnit \Framework \TestCase ;
14
14
use ReflectionClass ;
15
15
@@ -75,40 +75,48 @@ public function dataProviderInputData(): array
75
75
{
76
76
return [
77
77
[
78
- ['customer ' =>
79
- [
78
+ ['customer ' => [
80
79
'id ' => -1 ,
81
80
'Id ' => 1 ,
82
- 'name ' =>
83
- [
81
+ 'name ' => [
84
82
'firstName ' => 'Test ' ,
85
83
'LastName ' => 'user '
86
84
],
87
85
'isHavingOwnHouse ' => 1 ,
88
- 'address ' =>
89
- [
86
+ 'address ' => [
90
87
'street ' => '1st Street ' ,
91
88
'Street ' => '3rd Street ' ,
92
89
'city ' => 'London '
93
90
],
94
91
]
95
92
],
96
- ['customer ' =>
97
- [
93
+ ['customer ' => [
98
94
'id ' => -1 ,
99
- 'name ' =>
100
- [
95
+ 'name ' => [
101
96
'firstName ' => 'Test ' ,
102
97
'LastName ' => 'user '
103
98
],
104
99
'isHavingOwnHouse ' => 1 ,
105
- 'address ' =>
106
- [
100
+ 'address ' => [
107
101
'street ' => '1st Street ' ,
108
102
'city ' => 'London '
109
103
],
110
104
]
111
105
],
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
+ ],
112
120
]
113
121
];
114
122
}
You can’t perform that action at this time.
0 commit comments