@@ -111,29 +111,49 @@ public function testPrepare($name, $filterData, $expectedCondition)
111111 ->method ('addComponentDefinition ' )
112112 ->with (Input::NAME , ['extends ' => Input::NAME ]);
113113 $ this ->contextMock ->expects ($ this ->any ())
114- ->method ('getRequestParam ' )
115- ->with (UiContext::FILTER_VAR )
114+ ->method ('getFiltersParams ' )
116115 ->willReturn ($ filterData );
117116 $ dataProvider = $ this ->getMockForAbstractClass (
118117 \Magento \Framework \View \Element \UiComponent \DataProvider \DataProviderInterface::class,
119118 [],
120119 '' ,
121120 false
122121 );
122+
123123 $ this ->contextMock ->expects ($ this ->any ())
124124 ->method ('getDataProvider ' )
125125 ->willReturn ($ dataProvider );
126- if ($ expectedCondition !== null ) {
127- $ dataProvider ->expects ($ this ->any ())
128- ->method ('addFilter ' )
129- ->with ($ expectedCondition , $ name );
130- }
131126
132127 $ this ->uiComponentFactory ->expects ($ this ->any ())
133128 ->method ('create ' )
134129 ->with ($ name , Input::COMPONENT , ['context ' => $ this ->contextMock ])
135130 ->willReturn ($ uiComponent );
136131
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+
137157 $ date = new Input (
138158 $ this ->contextMock ,
139159 $ this ->uiComponentFactory ,
@@ -160,7 +180,12 @@ public function getPrepareDataProvider()
160180 [
161181 'test_date ' ,
162182 ['test_date ' => 'some_value ' ],
163- ['like ' => '%some_value% ' ],
183+ ['like ' => '%some\_value% ' ],
184+ ],
185+ [
186+ 'test_date ' ,
187+ ['test_date ' => '% ' ],
188+ ['like ' => '%\%% ' ],
164189 ],
165190 ];
166191 }
0 commit comments