File tree Expand file tree Collapse file tree 2 files changed +6
-25
lines changed
app/code/Magento/Analytics
Block/Adminhtml/System/Config
Test/Unit/Block/Adminhtml/System/Config Expand file tree Collapse file tree 2 files changed +6
-25
lines changed Original file line number Diff line number Diff line change 5
5
*/
6
6
namespace Magento \Analytics \Block \Adminhtml \System \Config ;
7
7
8
- use Magento \Backend \Block \Template \Context ;
9
- use Magento \Framework \Stdlib \DateTime \TimezoneInterface ;
10
-
11
8
/**
12
9
* Provides label with default Time Zone
13
10
*/
14
11
class CollectionTimeLabel extends \Magento \Config \Block \System \Config \Form \Field
15
12
{
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
-
35
13
/**
36
14
* Add default time zone to comment
37
15
*
@@ -40,7 +18,7 @@ public function __construct(
40
18
*/
41
19
public function render (\Magento \Framework \Data \Form \Element \AbstractElement $ element )
42
20
{
43
- $ timeZoneCode = $ this ->timeZone ->getConfigTimezone ();
21
+ $ timeZoneCode = $ this ->_localeDate ->getConfigTimezone ();
44
22
$ getLongTimeZoneName = \IntlTimeZone::createTimeZone ($ timeZoneCode )->getDisplayName ();
45
23
$ element ->setData (
46
24
'comment ' ,
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ protected function setUp()
43
43
->disableOriginalConstructor ()
44
44
->getMock ();
45
45
$ this ->contextMock = $ this ->getMockBuilder (Context::class)
46
+ ->setMethods (['getLocaleDate ' ])
46
47
->disableOriginalConstructor ()
47
48
->getMock ();
48
49
$ this ->formMock = $ this ->getMockBuilder (Form::class)
@@ -51,8 +52,10 @@ protected function setUp()
51
52
$ this ->timeZoneMock = $ this ->getMockBuilder (TimezoneInterface::class)
52
53
->disableOriginalConstructor ()
53
54
->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 );
56
59
}
57
60
58
61
/**
You can’t perform that action at this time.
0 commit comments