Skip to content

Commit 69d07c1

Browse files
author
Vaha
committed
#18012: improved cases for DataProviderTest
1 parent e26bbc1 commit 69d07c1

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

app/code/Magento/Translation/Test/Unit/Model/Js/DataProviderTest.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,24 +105,31 @@ public function testGetData()
105105
'hello1' => 'hello1translated',
106106
'hello2' => 'hello2translated',
107107
'hello3' => 'hello3translated',
108-
'hello4' => 'hello4translated'
108+
'hello4' => 'hello4translated',
109+
'ko i18' => 'ko i18 translated',
110+
'underscore i18' => 'underscore i18 translated',
109111
];
110112

111113
$contentsMap = [
112114
'content1$.mage.__("hello1")content1',
113115
'content2$.mage.__("hello2")content2',
114-
'content2$.mage.__("hello4")content4', // this value should be last after running data provider
115-
'content2$.mage.__("hello3")content3',
116+
'content2$.mage.__("hello4")content4 <!-- ko i18n: "ko i18" --><!-- /ko -->',
117+
'content2$.mage.__("hello3")content3 <% _.i18n("underscore i18") %>',
116118
];
117119

118120
$translateMap = [
119121
[['hello1'], [], 'hello1translated'],
120122
[['hello2'], [], 'hello2translated'],
121123
[['hello3'], [], 'hello3translated'],
122-
[['hello4'], [], 'hello4translated']
124+
[['hello4'], [], 'hello4translated'],
125+
[['ko i18'], [], 'ko i18 translated'],
126+
[['underscore i18'], [], 'underscore i18 translated'],
123127
];
124128

125-
$patterns = ['~\$\.mage\.__\(([\'"])(.+?)\1\)~'];
129+
$patterns = [
130+
'~\$\.mage\.__\(([\'"])(.+?)\1\)~',
131+
'~(?:i18n\:|_\.i18n\()\s*(["\'])(.*?)(?<!\\\\)\1~',
132+
];
126133

127134
$this->appStateMock->expects($this->once())
128135
->method('getAreaCode')

0 commit comments

Comments
 (0)