Skip to content

Commit fbb7fad

Browse files
author
Yevhen Miroshnychenko
authored
Merge pull request magento#3120 from magento-chaika/chaika_sept_22
Fixed issues: - MAGETWO-93939 Cannot clear Date of Birth value in customer edit page in Admin
2 parents 34ee561 + e564cb3 commit fbb7fad

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

app/code/Magento/Customer/Model/Metadata/Form/Date.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class Date extends AbstractData
1313
{
1414
/**
15-
* {@inheritdoc}
15+
* @inheritdoc
1616
*/
1717
public function extractValue(\Magento\Framework\App\RequestInterface $request)
1818
{
@@ -21,7 +21,7 @@ public function extractValue(\Magento\Framework\App\RequestInterface $request)
2121
}
2222

2323
/**
24-
* {@inheritdoc}
24+
* @inheritdoc
2525
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
2626
* @SuppressWarnings(PHPMD.NPathComplexity)
2727
*/
@@ -95,29 +95,23 @@ public function validateValue($value)
9595
}
9696

9797
/**
98-
* {@inheritdoc}
98+
* @inheritdoc
9999
*/
100100
public function compactValue($value)
101101
{
102-
if ($value !== false) {
103-
if (empty($value)) {
104-
$value = null;
105-
}
106-
return $value;
107-
}
108-
return false;
102+
return $value;
109103
}
110104

111105
/**
112-
* {@inheritdoc}
106+
* @inheritdoc
113107
*/
114108
public function restoreValue($value)
115109
{
116110
return $this->compactValue($value);
117111
}
118112

119113
/**
120-
* {@inheritdoc}
114+
* @inheritdoc
121115
*/
122116
public function outputValue($format = \Magento\Customer\Model\Metadata\ElementFactory::OUTPUT_FORMAT_TEXT)
123117
{

app/code/Magento/Customer/Test/Unit/Model/Metadata/Form/DateTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ class DateTest extends AbstractFormTestCase
1212
/** @var \Magento\Customer\Model\Metadata\Form\Date */
1313
protected $date;
1414

15+
/**
16+
* @inheritdoc
17+
*/
1518
protected function setUp()
1619
{
1720
parent::setUp();
@@ -46,6 +49,9 @@ protected function setUp()
4649
);
4750
}
4851

52+
/**
53+
* Test extractValue
54+
*/
4955
public function testExtractValue()
5056
{
5157
$requestMock = $this->getMockBuilder(\Magento\Framework\App\RequestInterface::class)
@@ -174,7 +180,7 @@ public function compactAndRestoreValueDataProvider()
174180
return [
175181
[1, 1],
176182
[false, false],
177-
['', null],
183+
[null, null],
178184
['test', 'test'],
179185
[['element1', 'element2'], ['element1', 'element2']]
180186
];
@@ -191,6 +197,9 @@ public function testRestoreValue($value, $expected)
191197
$this->assertSame($expected, $this->date->restoreValue($value));
192198
}
193199

200+
/**
201+
* Test outputValue
202+
*/
194203
public function testOutputValue()
195204
{
196205
$this->assertEquals(null, $this->date->outputValue());

0 commit comments

Comments
 (0)