6
6
namespace Magento \Ui \Test \Unit \Component \Filters \Type ;
7
7
8
8
use Magento \Framework \View \Element \UiComponent \ContextInterface ;
9
- use Magento \Framework \View \Element \UiComponent \ContextInterface as UiContext ;
10
9
use Magento \Framework \View \Element \UiComponentFactory ;
11
10
use Magento \Framework \View \Element \UiComponentInterface ;
12
11
use Magento \Ui \Component \Filters \Type \Input ;
@@ -37,18 +36,18 @@ class InputTest extends \PHPUnit\Framework\TestCase
37
36
protected $ filterModifierMock ;
38
37
39
38
/**
40
- * Set up
39
+ * @inheritdoc
41
40
*/
42
41
protected function setUp ()
43
42
{
44
43
$ this ->contextMock = $ this ->getMockForAbstractClass (
45
- \ Magento \ Framework \ View \ Element \ UiComponent \ ContextInterface::class,
44
+ ContextInterface::class,
46
45
[],
47
46
'' ,
48
47
false
49
48
);
50
49
$ this ->uiComponentFactory = $ this ->createPartialMock (
51
- \ Magento \ Framework \ View \ Element \ UiComponentFactory::class,
50
+ UiComponentFactory::class,
52
51
['create ' ]
53
52
);
54
53
$ this ->filterBuilderMock = $ this ->createMock (\Magento \Framework \Api \FilterBuilder::class);
@@ -63,7 +62,7 @@ protected function setUp()
63
62
*
64
63
* @return void
65
64
*/
66
- public function testGetComponentName ()
65
+ public function testGetComponentName (): void
67
66
{
68
67
$ this ->contextMock ->expects ($ this ->never ())->method ('getProcessor ' );
69
68
$ date = new Input (
@@ -86,15 +85,15 @@ public function testGetComponentName()
86
85
* @dataProvider getPrepareDataProvider
87
86
* @return void
88
87
*/
89
- public function testPrepare ($ name , $ filterData , $ expectedCondition )
88
+ public function testPrepare (string $ name , array $ filterData , ? array $ expectedCondition ): void
90
89
{
91
90
$ processor = $ this ->getMockBuilder (\Magento \Framework \View \Element \UiComponent \Processor::class)
92
91
->disableOriginalConstructor ()
93
92
->getMock ();
94
93
$ this ->contextMock ->expects ($ this ->atLeastOnce ())->method ('getProcessor ' )->willReturn ($ processor );
95
94
/** @var UiComponentInterface $uiComponent */
96
95
$ uiComponent = $ this ->getMockForAbstractClass (
97
- \ Magento \ Framework \ View \ Element \ UiComponentInterface::class,
96
+ UiComponentInterface::class,
98
97
[],
99
98
'' ,
100
99
false
@@ -169,14 +168,24 @@ public function testPrepare($name, $filterData, $expectedCondition)
169
168
/**
170
169
* @return array
171
170
*/
172
- public function getPrepareDataProvider ()
171
+ public function getPrepareDataProvider (): array
173
172
{
174
173
return [
175
174
[
176
175
'test_date ' ,
177
176
['test_date ' => '' ],
178
177
null ,
179
178
],
179
+ [
180
+ 'test_date ' ,
181
+ ['test_date ' => null ],
182
+ null ,
183
+ ],
184
+ [
185
+ 'test_date ' ,
186
+ ['test_date ' => '0 ' ],
187
+ ['like ' => '%0% ' ],
188
+ ],
180
189
[
181
190
'test_date ' ,
182
191
['test_date ' => 'some_value ' ],
0 commit comments