Skip to content

Commit e47f418

Browse files
committed
MAGETWO-63986: Fatal Error in Date form filter due to incorrect method signature
- Unit Test updated
1 parent 5212548 commit e47f418

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/AbstractDataTest.php

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ public function extractedDataDataProvider()
9595
* @param string $expectedResult
9696
* @param array $params
9797
* @param bool $requestScopeOnly
98+
* @param string|null $filter
9899
* @dataProvider getRequestValueDataProvider
99100
*/
100-
public function testGetRequestValue($requestScope, $value, $params, $requestScopeOnly, $expectedResult)
101+
public function testGetRequestValue($requestScope, $value, $params, $requestScopeOnly, $expectedResult, $filter)
101102
{
102103
$requestMock = $this->getMock(
103104
\Magento\Framework\App\Request\Http::class,
@@ -112,8 +113,17 @@ public function testGetRequestValue($requestScope, $value, $params, $requestScop
112113
]));
113114
$requestMock->expects($this->any())->method('getParams')->will($this->returnValue($params));
114115

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+
);
116123
$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+
}
117127

118128
$this->model->setAttribute($attributeMock);
119129
$this->model->setRequestScope($requestScope);
@@ -133,41 +143,55 @@ public function getRequestValueDataProvider()
133143
'params' => [],
134144
'requestScopeOnly' => true,
135145
'expectedResult' => 'value',
146+
'filter' => null,
136147
],
137148
[
138149
'requestScope' => 'scope/scope',
139150
'value' => 'value',
140151
'params' => ['scope' => ['scope' => ['attributeCode' => 'data']]],
141152
'requestScopeOnly' => true,
142-
'expectedResult' => 'data'
153+
'expectedResult' => 'data',
154+
'filter' => null,
143155
],
144156
[
145157
'requestScope' => 'scope/scope',
146158
'value' => 'value',
147159
'params' => ['scope' => ['scope' => []]],
148160
'requestScopeOnly' => true,
149-
'expectedResult' => false
161+
'expectedResult' => false,
162+
'filter' => null,
150163
],
151164
[
152165
'requestScope' => 'scope/scope',
153166
'value' => 'value',
154167
'params' => ['scope'],
155168
'requestScopeOnly' => true,
156-
'expectedResult' => false
169+
'expectedResult' => false,
170+
'filter' => null,
157171
],
158172
[
159173
'requestScope' => 'scope',
160174
'value' => 'value',
161175
'params' => ['otherScope' => 1],
162176
'requestScopeOnly' => true,
163-
'expectedResult' => false
177+
'expectedResult' => false,
178+
'filter' => null,
164179
],
165180
[
166181
'requestScope' => 'scope',
167182
'value' => 'value',
168183
'params' => ['otherScope' => 1],
169184
'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'
171195
]
172196
];
173197
}

0 commit comments

Comments
 (0)