@@ -95,9 +95,10 @@ public function extractedDataDataProvider()
95
95
* @param string $expectedResult
96
96
* @param array $params
97
97
* @param bool $requestScopeOnly
98
+ * @param string|null $filter
98
99
* @dataProvider getRequestValueDataProvider
99
100
*/
100
- public function testGetRequestValue ($ requestScope , $ value , $ params , $ requestScopeOnly , $ expectedResult )
101
+ public function testGetRequestValue ($ requestScope , $ value , $ params , $ requestScopeOnly , $ expectedResult, $ filter )
101
102
{
102
103
$ requestMock = $ this ->getMock (
103
104
\Magento \Framework \App \Request \Http::class,
@@ -112,8 +113,17 @@ public function testGetRequestValue($requestScope, $value, $params, $requestScop
112
113
]));
113
114
$ requestMock ->expects ($ this ->any ())->method ('getParams ' )->will ($ this ->returnValue ($ params ));
114
115
115
- $ attributeMock = $ this ->getMock (\Magento \Eav \Model \Attribute::class, [], [], '' , false );
116
+ $ attributeMock = $ this ->getMock (
117
+ \Magento \Eav \Model \Attribute::class,
118
+ ['getInputFilter ' , 'getAttributeCode ' ],
119
+ [],
120
+ '' ,
121
+ false
122
+ );
116
123
$ attributeMock ->expects ($ this ->any ())->method ('getAttributeCode ' )->will ($ this ->returnValue ('attributeCode ' ));
124
+ if ($ filter ) {
125
+ $ attributeMock ->expects ($ this ->any ())->method ('getInputFilter ' )->will ($ this ->returnValue ($ filter ));
126
+ }
117
127
118
128
$ this ->model ->setAttribute ($ attributeMock );
119
129
$ this ->model ->setRequestScope ($ requestScope );
@@ -133,41 +143,55 @@ public function getRequestValueDataProvider()
133
143
'params ' => [],
134
144
'requestScopeOnly ' => true ,
135
145
'expectedResult ' => 'value ' ,
146
+ 'filter ' => null ,
136
147
],
137
148
[
138
149
'requestScope ' => 'scope/scope ' ,
139
150
'value ' => 'value ' ,
140
151
'params ' => ['scope ' => ['scope ' => ['attributeCode ' => 'data ' ]]],
141
152
'requestScopeOnly ' => true ,
142
- 'expectedResult ' => 'data '
153
+ 'expectedResult ' => 'data ' ,
154
+ 'filter ' => null ,
143
155
],
144
156
[
145
157
'requestScope ' => 'scope/scope ' ,
146
158
'value ' => 'value ' ,
147
159
'params ' => ['scope ' => ['scope ' => []]],
148
160
'requestScopeOnly ' => true ,
149
- 'expectedResult ' => false
161
+ 'expectedResult ' => false ,
162
+ 'filter ' => null ,
150
163
],
151
164
[
152
165
'requestScope ' => 'scope/scope ' ,
153
166
'value ' => 'value ' ,
154
167
'params ' => ['scope ' ],
155
168
'requestScopeOnly ' => true ,
156
- 'expectedResult ' => false
169
+ 'expectedResult ' => false ,
170
+ 'filter ' => null ,
157
171
],
158
172
[
159
173
'requestScope ' => 'scope ' ,
160
174
'value ' => 'value ' ,
161
175
'params ' => ['otherScope ' => 1 ],
162
176
'requestScopeOnly ' => true ,
163
- 'expectedResult ' => false
177
+ 'expectedResult ' => false ,
178
+ 'filter ' => null ,
164
179
],
165
180
[
166
181
'requestScope ' => 'scope ' ,
167
182
'value ' => 'value ' ,
168
183
'params ' => ['otherScope ' => 1 ],
169
184
'requestScopeOnly ' => false ,
170
- 'expectedResult ' => 'value '
185
+ 'expectedResult ' => 'value ' ,
186
+ 'filter ' => null ,
187
+ ],
188
+ [
189
+ 'requestScope ' => 'scope ' ,
190
+ 'value ' => '1970-01-01 ' ,
191
+ 'params ' => [],
192
+ 'requestScopeOnly ' => false ,
193
+ 'expectedResult ' => '1970-01-01 ' ,
194
+ 'filter ' => 'date '
171
195
]
172
196
];
173
197
}
0 commit comments