|
6 | 6 |
|
7 | 7 | namespace Magento\Framework\Locale\Test\Unit;
|
8 | 8 |
|
9 |
| -class TranslatedListsTest extends \PHPUnit\Framework\TestCase |
| 9 | +use Magento\Framework\Locale\ConfigInterface; |
| 10 | +use Magento\Framework\Locale\ResolverInterface; |
| 11 | +use Magento\Framework\Locale\TranslatedLists; |
| 12 | +use PHPUnit\Framework\MockObject\MockObject; |
| 13 | +use PHPUnit\Framework\TestCase; |
| 14 | + |
| 15 | +class TranslatedListsTest extends TestCase |
10 | 16 | {
|
11 | 17 | /**
|
12 |
| - * @var \Magento\Framework\Locale\TranslatedLists |
| 18 | + * @var TranslatedLists |
13 | 19 | */
|
14 | 20 | protected $listsModel;
|
15 | 21 |
|
16 | 22 | /**
|
17 |
| - * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Locale\ConfigInterface |
| 23 | + * @var MockObject | ConfigInterface |
18 | 24 | */
|
19 | 25 | protected $mockConfig;
|
20 | 26 |
|
21 | 27 | /**
|
22 |
| - * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Locale\ResolverInterface |
| 28 | + * @var MockObject | ResolverInterface |
23 | 29 | */
|
24 | 30 | protected $mockLocaleResolver;
|
25 | 31 |
|
26 | 32 | protected function setUp()
|
27 | 33 | {
|
28 |
| - $this->mockConfig = $this->getMockBuilder(\Magento\Framework\Locale\ConfigInterface::class) |
| 34 | + $this->mockConfig = $this->getMockBuilder(ConfigInterface::class) |
29 | 35 | ->disableOriginalConstructor()
|
30 | 36 | ->getMock();
|
31 |
| - $this->mockLocaleResolver = $this->getMockBuilder(\Magento\Framework\Locale\ResolverInterface::class) |
| 37 | + $this->mockLocaleResolver = $this->getMockBuilder(ResolverInterface::class) |
32 | 38 | ->disableOriginalConstructor()
|
33 | 39 | ->getMock();
|
34 | 40 | $this->mockLocaleResolver->expects($this->once())
|
35 | 41 | ->method('getLocale')
|
36 |
| - ->will($this->returnValue('en_US')); |
| 42 | + ->willReturn('en_US'); |
37 | 43 |
|
38 |
| - $this->listsModel = new \Magento\Framework\Locale\TranslatedLists( |
| 44 | + $this->listsModel = new TranslatedLists( |
39 | 45 | $this->mockConfig,
|
40 | 46 | $this->mockLocaleResolver
|
41 | 47 | );
|
@@ -67,13 +73,13 @@ public function testGetOptionCurrencies()
|
67 | 73 |
|
68 | 74 | $this->mockConfig->expects($this->once())
|
69 | 75 | ->method('getAllowedCurrencies')
|
70 |
| - ->will($this->returnValue($allowedCurrencies)); |
| 76 | + ->willReturn($allowedCurrencies); |
71 | 77 |
|
72 | 78 | $expectedResults = ['USD', 'EUR', 'GBP', 'UAH'];
|
73 | 79 |
|
74 | 80 | $currencyList = $this->listsModel->getOptionCurrencies();
|
75 | 81 | $currencyCodes = array_map(
|
76 |
| - function ($data) { |
| 82 | + static function ($data) { |
77 | 83 | return $data['value'];
|
78 | 84 | },
|
79 | 85 | $currencyList
|
@@ -166,6 +172,6 @@ protected function setupForOptionLocales()
|
166 | 172 | $allowedLocales = ['en_US', 'uk_UA', 'de_DE'];
|
167 | 173 | $this->mockConfig->expects($this->once())
|
168 | 174 | ->method('getAllowedLocales')
|
169 |
| - ->will($this->returnValue($allowedLocales)); |
| 175 | + ->willReturn($allowedLocales); |
170 | 176 | }
|
171 | 177 | }
|
0 commit comments