7
7
8
8
namespace Magento \Catalog \Block \Product \View ;
9
9
10
+ use Magento \Framework \Locale \ResolverInterface ;
10
11
use Magento \Store \Model \StoreManagerInterface ;
11
12
12
13
/**
@@ -20,13 +21,17 @@ class MultiStoreCurrencyTest extends AbstractCurrencyTest
20
21
/** @var StoreManagerInterface */
21
22
private $ storeManager ;
22
23
24
+ /** @var ResolverInterface */
25
+ private $ localeResolver ;
26
+
23
27
/**
24
28
* @inheritdoc
25
29
*/
26
30
protected function setUp (): void
27
31
{
28
32
parent ::setUp ();
29
33
34
+ $ this ->localeResolver = $ this ->objectManager ->get (ResolverInterface::class);
30
35
$ this ->storeManager = $ this ->objectManager ->get (StoreManagerInterface::class);
31
36
}
32
37
@@ -46,9 +51,12 @@ protected function setUp(): void
46
51
*/
47
52
public function testMultiStoreRenderPrice (): void
48
53
{
49
- $ this ->assertProductStorePrice ('simple2 ' , 'CN¥70.00 ' );
54
+ $ this ->localeResolver ->setLocale ('zh_CN ' );
55
+ $ this ->assertProductStorePrice ('simple2 ' , '¥70.00 ' );
56
+
50
57
$ this ->reloadProductPriceInfo ();
51
- $ this ->assertProductStorePrice ('simple2 ' , '₴240.00 ' , 'fixturestore ' );
58
+ $ this ->localeResolver ->setLocale ('uk_UA ' );
59
+ $ this ->assertProductStorePrice ('simple2 ' , '240,00 ₴ ' , 'fixturestore ' );
52
60
}
53
61
54
62
/**
@@ -67,9 +75,12 @@ public function testMultiStoreRenderPrice(): void
67
75
*/
68
76
public function testMultiStoreRenderSpecialPrice (): void
69
77
{
70
- $ this ->assertProductStorePrice ('simple ' , 'Special Price CN¥41.93 Regular Price CN¥70.00 ' );
78
+ $ this ->localeResolver ->setLocale ('zh_CN ' );
79
+ $ this ->assertProductStorePrice ('simple ' , 'Special Price ¥41.93 Regular Price ¥70.00 ' );
80
+
71
81
$ this ->reloadProductPriceInfo ();
72
- $ this ->assertProductStorePrice ('simple ' , 'Special Price ₴143.76 Regular Price ₴240.00 ' , 'fixturestore ' );
82
+ $ this ->localeResolver ->setLocale ('uk_UA ' );
83
+ $ this ->assertProductStorePrice ('simple ' , 'Special Price 143,76 ₴ Regular Price 240,00 ₴ ' , 'fixturestore ' );
73
84
}
74
85
75
86
/**
@@ -88,16 +99,19 @@ public function testMultiStoreRenderSpecialPrice(): void
88
99
*/
89
100
public function testMultiStoreRenderTierPrice (): void
90
101
{
102
+ $ this ->localeResolver ->setLocale ('zh_CN ' );
91
103
$ this ->assertProductStorePrice (
92
104
'simple-product-tax-none ' ,
93
- 'Buy 2 for CN¥ 280.00 each and save 80% ' ,
105
+ 'Buy 2 for ¥ 280.00 each and save 80% ' ,
94
106
'default ' ,
95
107
self ::TIER_PRICE_BLOCK_NAME
96
108
);
109
+
97
110
$ this ->reloadProductPriceInfo ();
111
+ $ this ->localeResolver ->setLocale ('uk_UA ' );
98
112
$ this ->assertProductStorePrice (
99
113
'simple-product-tax-none ' ,
100
- 'Buy 2 for ₴ 960.00 each and save 80% ' ,
114
+ 'Buy 2 for 960,00 ₴ each and save 80% ' ,
101
115
'fixturestore ' ,
102
116
self ::TIER_PRICE_BLOCK_NAME
103
117
);
@@ -125,7 +139,7 @@ private function assertProductStorePrice(
125
139
}
126
140
127
141
$ actualData = $ this ->processPriceView ($ productSku , $ priceBlockName );
128
- $ this -> assertEquals ($ expectedData , $ actualData );
142
+ self :: assertEquals ($ expectedData , $ actualData );
129
143
} finally {
130
144
if ($ currentStore ->getCode () !== $ storeCode ) {
131
145
$ this ->storeManager ->setCurrentStore ($ currentStore );
@@ -141,7 +155,16 @@ private function assertProductStorePrice(
141
155
private function reloadProductPriceInfo (): void
142
156
{
143
157
$ product = $ this ->registry ->registry ('product ' );
144
- $ this -> assertNotNull ($ product );
158
+ self :: assertNotNull ($ product );
145
159
$ product ->reloadPriceInfo ();
146
160
}
161
+
162
+ /**
163
+ * @inheritDoc
164
+ */
165
+ protected function tearDown (): void
166
+ {
167
+ $ this ->localeResolver ->setLocale (\Magento \Setup \Module \I18n \Locale::DEFAULT_SYSTEM_LOCALE );
168
+ parent ::tearDown ();
169
+ }
147
170
}
0 commit comments