File tree Expand file tree Collapse file tree 4 files changed +66
-1
lines changed
Model/Config/Source/Locale
Test/Unit/Model/Config/Source/Locale
dev/tests/functional/tests/app/Magento/Cms/Test/Page Expand file tree Collapse file tree 4 files changed +66
-1
lines changed Original file line number Diff line number Diff line change 11
11
12
12
class Timezone implements \Magento \Framework \Option \ArrayInterface
13
13
{
14
+ /**
15
+ * Timezones that works incorrect with php_intl extension
16
+ */
17
+ const IGNORED_TIMEZONES = [
18
+ 'Antarctica/Troll ' ,
19
+ 'Asia/Chita ' ,
20
+ 'Asia/Srednekolymsk ' ,
21
+ 'Pacific/Bougainville '
22
+ ];
23
+
14
24
/**
15
25
* @var \Magento\Framework\Locale\ListsInterface
16
26
*/
@@ -29,6 +39,14 @@ public function __construct(\Magento\Framework\Locale\ListsInterface $localeList
29
39
*/
30
40
public function toOptionArray ()
31
41
{
32
- return $ this ->_localeLists ->getOptionTimezones ();
42
+ $ timezones = $ this ->_localeLists ->getOptionTimezones ();
43
+ $ timezones = array_filter ($ timezones , function ($ value ) {
44
+ if (in_array ($ value ['value ' ], static ::IGNORED_TIMEZONES )) {
45
+ return false ;
46
+ }
47
+ return true ;
48
+ });
49
+
50
+ return $ timezones ;
33
51
}
34
52
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © 2015 Magento. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ namespace Magento \Config \Test \Unit \Model \Config \Locale ;
7
+
8
+ class LoaderTest extends \PHPUnit_Framework_TestCase
9
+ {
10
+ /**
11
+ * @var \PHPUnit_Framework_MockObject_MockObject
12
+ */
13
+ protected $ listMock ;
14
+
15
+ /**
16
+ * @var \Magento\Config\Model\Config\Source\Locale\Timezone
17
+ */
18
+ protected $ model ;
19
+
20
+ protected function setUp ()
21
+ {
22
+ $ this ->listMock = $ this ->getMockBuilder ('Magento\Framework\Locale\TranslatedLists ' )
23
+ ->disableOriginalConstructor ()
24
+ ->getMock ();
25
+ $ this ->model = new \Magento \Config \Model \Config \Source \Locale \Timezone ($ this ->listMock );
26
+ }
27
+
28
+ public function testToOptionArray ()
29
+ {
30
+ $ list = \DateTimeZone::listIdentifiers ();
31
+ $ preparedList = [];
32
+ foreach ($ list as $ value ) {
33
+ $ preparedList [] = ['value ' => $ value , 'label ' => $ value ];
34
+ }
35
+ $ this ->listMock ->expects ($ this ->once ())
36
+ ->method ('getOptionTimezones ' )
37
+ ->willReturn ($ preparedList );
38
+ $ result = $ this ->model ->toOptionArray ();
39
+ foreach ($ result as $ value ) {
40
+ if (in_array ($ value ['value ' ], \Magento \Config \Model \Config \Source \Locale \Timezone::IGNORED_TIMEZONES )) {
41
+ $ this ->fail ('Locale ' . $ value ['value ' ] . ' shouldn \'t be presented ' );
42
+ }
43
+ }
44
+ }
45
+ }
Original file line number Diff line number Diff line change @@ -427,6 +427,7 @@ public function setCanSendNewEmailFlag($flag)
427
427
/**
428
428
* Load order by system increment identifier
429
429
*
430
+ * @deprecated
430
431
* @param string $incrementId
431
432
* @return \Magento\Sales\Model\Order
432
433
*/
Original file line number Diff line number Diff line change 18
18
<block name =" currencyBlock" class =" Magento\Directory\Test\Block\Currency\Switcher" locator =" .switcher.currency" strategy =" css selector" />
19
19
<block name =" cmsPageBlock" class =" Magento\Cms\Test\Block\Page" locator =" .page-main" strategy =" css selector" />
20
20
<block name =" widgetView" class =" Magento\Widget\Test\Block\WidgetView" locator =" .widget" strategy =" css selector" />
21
+ <block name =" messagesBlock" class =" Magento\Backend\Test\Block\Messages" locator =" .messages" strategy =" css selector" />
21
22
</page >
22
23
</config >
You can’t perform that action at this time.
0 commit comments