Skip to content

Commit 6630b04

Browse files
committed
MAGETWO-66141: Change exist config FAT's
1 parent 0698339 commit 6630b04

File tree

2 files changed

+6
-25
lines changed

2 files changed

+6
-25
lines changed

app/code/Magento/Analytics/Block/Adminhtml/System/Config/CollectionTimeLabel.php

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,11 @@
55
*/
66
namespace Magento\Analytics\Block\Adminhtml\System\Config;
77

8-
use Magento\Backend\Block\Template\Context;
9-
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
10-
118
/**
129
* Provides label with default Time Zone
1310
*/
1411
class CollectionTimeLabel extends \Magento\Config\Block\System\Config\Form\Field
1512
{
16-
/**
17-
* @var TimezoneInterface
18-
*/
19-
private $timeZone;
20-
21-
/**
22-
* @param Context $context
23-
* @param TimezoneInterface $timeZone
24-
* @param array $data
25-
*/
26-
public function __construct(
27-
Context $context,
28-
TimezoneInterface $timeZone,
29-
array $data = []
30-
) {
31-
parent::__construct($context, $data);
32-
$this->timeZone = $timeZone;
33-
}
34-
3513
/**
3614
* Add default time zone to comment
3715
*
@@ -40,7 +18,7 @@ public function __construct(
4018
*/
4119
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
4220
{
43-
$timeZoneCode = $this->timeZone->getConfigTimezone();
21+
$timeZoneCode = $this->_localeDate->getConfigTimezone();
4422
$getLongTimeZoneName = \IntlTimeZone::createTimeZone($timeZoneCode)->getDisplayName();
4523
$element->setData(
4624
'comment',

app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/CollectionTimeLabelTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ protected function setUp()
4343
->disableOriginalConstructor()
4444
->getMock();
4545
$this->contextMock = $this->getMockBuilder(Context::class)
46+
->setMethods(['getLocaleDate'])
4647
->disableOriginalConstructor()
4748
->getMock();
4849
$this->formMock = $this->getMockBuilder(Form::class)
@@ -51,8 +52,10 @@ protected function setUp()
5152
$this->timeZoneMock = $this->getMockBuilder(TimezoneInterface::class)
5253
->disableOriginalConstructor()
5354
->getMock();
54-
55-
$this->collectionTimeLabel = new CollectionTimeLabel($this->contextMock, $this->timeZoneMock);
55+
$this->contextMock->expects($this->any())
56+
->method('getLocaleDate')
57+
->willReturn($this->timeZoneMock);
58+
$this->collectionTimeLabel = new CollectionTimeLabel($this->contextMock);
5659
}
5760

5861
/**

0 commit comments

Comments
 (0)