Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ListsTest.php
Go to the documentation of this file.
1 <?php
8 
10 
11 class ListsTest extends \PHPUnit\Framework\TestCase
12 {
16  protected $lists;
17 
21  protected $mockConfig;
22 
26  protected $expectedTimezones = [
27  'Australia/Darwin',
28  'America/Los_Angeles',
29  'Europe/Kiev',
30  'Asia/Jerusalem',
31  ];
32 
36  protected $expectedCurrencies = [
37  'USD',
38  'EUR',
39  'UAH',
40  'GBP',
41  ];
42 
46  protected $expectedLocales = [
47  'en_US',
48  'en_GB',
49  'uk_UA',
50  'de_DE',
51  ];
52 
53  protected function setUp()
54  {
55  $this->mockConfig = $this->getMockBuilder(\Magento\Framework\Locale\ConfigInterface::class)
56  ->disableOriginalConstructor()
57  ->getMock();
58  $this->mockConfig->expects($this->any())
59  ->method('getAllowedLocales')
60  ->willReturn($this->expectedLocales);
61  $this->mockConfig->expects($this->any())
62  ->method('getAllowedCurrencies')
63  ->willReturn($this->expectedCurrencies);
64 
65  $this->lists = new Lists($this->mockConfig);
66  }
67 
68  public function testGetTimezoneList()
69  {
70  $timezones = array_intersect($this->expectedTimezones, array_keys($this->lists->getTimezoneList()));
71  $this->assertEquals($this->expectedTimezones, $timezones);
72  }
73 
74  public function testGetLocaleList()
75  {
76  $locales = array_intersect($this->expectedLocales, array_keys($this->lists->getLocaleList()));
77  $this->assertEquals($this->expectedLocales, $locales);
78  }
79 
83  public function testGetCurrencyList()
84  {
85  $currencies = array_intersect($this->expectedCurrencies, array_keys($this->lists->getCurrencyList()));
86  $this->assertEquals($this->expectedCurrencies, $currencies);
87  }
88 }
$locales
Definition: locales.php:14