@@ -111,29 +111,49 @@ public function testPrepare($name, $filterData, $expectedCondition)
111
111
->method ('addComponentDefinition ' )
112
112
->with (Input::NAME , ['extends ' => Input::NAME ]);
113
113
$ this ->contextMock ->expects ($ this ->any ())
114
- ->method ('getRequestParam ' )
115
- ->with (UiContext::FILTER_VAR )
114
+ ->method ('getFiltersParams ' )
116
115
->willReturn ($ filterData );
117
116
$ dataProvider = $ this ->getMockForAbstractClass (
118
117
\Magento \Framework \View \Element \UiComponent \DataProvider \DataProviderInterface::class,
119
118
[],
120
119
'' ,
121
120
false
122
121
);
122
+
123
123
$ this ->contextMock ->expects ($ this ->any ())
124
124
->method ('getDataProvider ' )
125
125
->willReturn ($ dataProvider );
126
- if ($ expectedCondition !== null ) {
127
- $ dataProvider ->expects ($ this ->any ())
128
- ->method ('addFilter ' )
129
- ->with ($ expectedCondition , $ name );
130
- }
131
126
132
127
$ this ->uiComponentFactory ->expects ($ this ->any ())
133
128
->method ('create ' )
134
129
->with ($ name , Input::COMPONENT , ['context ' => $ this ->contextMock ])
135
130
->willReturn ($ uiComponent );
136
131
132
+ if ($ expectedCondition !== null ) {
133
+ $ this ->filterBuilderMock ->expects ($ this ->once ())
134
+ ->method ('setConditionType ' )
135
+ ->with ('like ' )
136
+ ->willReturnSelf ();
137
+
138
+ $ this ->filterBuilderMock ->expects ($ this ->once ())
139
+ ->method ('setField ' )
140
+ ->with ($ name )
141
+ ->willReturnSelf ();
142
+
143
+ $ this ->filterBuilderMock ->expects ($ this ->once ())
144
+ ->method ('setValue ' )
145
+ ->with ($ expectedCondition ['like ' ])
146
+ ->willReturnSelf ();
147
+
148
+ $ filterMock = $ this ->getMockBuilder (\Magento \Framework \Api \Filter::class)
149
+ ->disableOriginalConstructor ()
150
+ ->getMock ();
151
+
152
+ $ this ->filterBuilderMock ->expects ($ this ->once ())
153
+ ->method ('create ' )
154
+ ->willReturn ($ filterMock );
155
+ }
156
+
137
157
$ date = new Input (
138
158
$ this ->contextMock ,
139
159
$ this ->uiComponentFactory ,
@@ -160,7 +180,12 @@ public function getPrepareDataProvider()
160
180
[
161
181
'test_date ' ,
162
182
['test_date ' => 'some_value ' ],
163
- ['like ' => '%some_value% ' ],
183
+ ['like ' => '%some\_value% ' ],
184
+ ],
185
+ [
186
+ 'test_date ' ,
187
+ ['test_date ' => '% ' ],
188
+ ['like ' => '%\%% ' ],
164
189
],
165
190
];
166
191
}
0 commit comments