Skip to content

Commit e33f96c

Browse files
committed
MAGETWO-34390: Stabilization of replacing Zend_Locale with Native PHP Implementation
1 parent 1f2f0b8 commit e33f96c

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Attribute/Frontend/DatetimeTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ protected function setUp()
5555
public function testGetValue()
5656
{
5757
$attributeValue = '11-11-2011';
58-
$dateFormat = 'dd-MM-yyyy';
58+
$date = new \DateTime($attributeValue);
5959
$object = new \Magento\Framework\Object(['datetime' => $attributeValue]);
6060
$this->attributeMock->expects($this->any())->method('getData')->with('frontend_input')
6161
->will($this->returnValue('text'));
6262

63-
$this->localeDateMock->expects($this->once())->method('getDateFormat')
64-
->with(\IntlDateFormatter::MEDIUM)
65-
->will($this->returnValue($dateFormat));
63+
$this->localeDateMock->expects($this->once())->method('formatDateTime')
64+
->with($date, \IntlDateFormatter::MEDIUM, \IntlDateFormatter::NONE, null, null, null)
65+
->willReturn($attributeValue);
6666
$this->localeDateMock->expects($this->once())->method('date')
67-
->with($attributeValue)
68-
->willReturn(new \DateTime($attributeValue));
67+
->with($date)
68+
->willReturn($date);
6969

7070
$this->assertEquals($attributeValue, $this->model->getValue($object));
7171
}

dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/DateTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ class DateTest extends \PHPUnit_Framework_TestCase
3131
*/
3232
protected $escaperMock;
3333

34+
/**
35+
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject
36+
*/
37+
protected $localeDateMock;
38+
3439
protected function setUp()
3540
{
3641
$this->factoryMock = $this->getMock('Magento\Framework\Data\Form\Element\Factory', [], [], '', false);
@@ -42,10 +47,18 @@ protected function setUp()
4247
false
4348
);
4449
$this->escaperMock = $this->getMock('Magento\Framework\Escaper', [], [], '', false);
50+
$this->localeDateMock = $this->getMock(
51+
'\Magento\Framework\Stdlib\DateTime\TimezoneInterface',
52+
[],
53+
[],
54+
'',
55+
false
56+
);
4557
$this->model = new Date(
4658
$this->factoryMock,
4759
$this->collectionFactoryMock,
48-
$this->escaperMock
60+
$this->escaperMock,
61+
$this->localeDateMock
4962
);
5063
}
5164

0 commit comments

Comments
 (0)