forked from php-gettext/Gettext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AssetsTest.php
504 lines (443 loc) · 27.8 KB
/
AssetsTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
<?php
namespace Gettext\Tests;
use Gettext\Extractors\PhpCode;
use Gettext\Translations;
class AssetsTest extends AbstractTest
{
public function testPo()
{
$translations = static::get('po/input', 'Po');
$countTranslations = 3;
$countTranslated = 3;
$countHeaders = 9;
$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
$this->assertEquals(3, $translations->countTranslated());
$disabled = $translations->find('', 'one');
$this->assertTrue($disabled->isDisabled());
$disabled = $translations->find('', 'single');
$this->assertFalse($disabled->isDisabled());
$this->assertContent($translations, 'po/Po');
$this->assertContent($translations, 'po/Mo');
$this->assertContent($translations, 'po/PhpArray');
$this->assertContent($translations, 'po/Jed');
$this->assertContent($translations, 'po/Json');
$this->assertContent($translations, 'po/JsonDictionary');
$this->assertContent($translations, 'po/Csv');
$this->assertContent($translations, 'po/CsvDictionary');
$this->assertContent($translations, 'po/Xliff');
$this->assertContent($translations, 'po/Yaml');
$this->assertContent($translations, 'po/YamlDictionary');
$this->runTestFormat('po/Po', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('po/Mo', $countTranslations - 1, $countTranslated - 1, $countHeaders);
$this->runTestFormat('po/PhpArray', $countTranslations - 1, $countTranslated - 1, $countHeaders);
$this->runTestFormat('po/Jed', $countTranslations - 1, $countTranslated - 1, 10);
$this->runTestFormat('po/Xliff', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('po/Json', $countTranslations - 1, $countTranslated - 1, $countHeaders);
$this->runTestFormat('po/JsonDictionary', $countTranslations - 1, $countTranslated - 1);
$this->runTestFormat('po/Csv', $countTranslations - 1, $countTranslated - 1, $countHeaders);
$this->runTestFormat('po/CsvDictionary', $countTranslations - 1, $countTranslated - 1);
$this->runTestFormat('po/Yaml', $countTranslations - 1, $countTranslated - 1, $countHeaders);
$this->runTestFormat('po/YamlDictionary', $countTranslations - 1, $countTranslated - 1);
}
public function testPo2()
{
$translations = static::get('po2/input', 'Po');
$countTranslations = 13;
$countTranslated = 10;
$countHeaders = 13;
$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
$this->assertEquals(10, $translations->countTranslated());
$this->assertContent($translations, 'po2/Po');
$this->assertContent($translations, 'po2/Mo');
$this->assertContent($translations, 'po2/PhpArray');
$this->assertContent($translations, 'po2/Jed');
$this->assertContent($translations, 'po2/Json');
$this->assertContent($translations, 'po2/JsonDictionary');
$this->assertContent($translations, 'po2/Csv');
$this->assertContent($translations, 'po2/CsvDictionary');
$this->assertContent($translations, 'po2/Xliff');
$this->assertContent($translations, 'po2/Yaml');
$this->assertContent($translations, 'po2/YamlDictionary');
$this->runTestFormat('po2/Po', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('po2/Mo', $countTranslations - 3, $countTranslated, $countHeaders);
$this->runTestFormat('po2/PhpArray', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('po2/Jed', $countTranslations, $countTranslated, 10);
$this->runTestFormat('po2/Xliff', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('po2/Json', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('po2/JsonDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('po2/Csv', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('po2/CsvDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('po2/Yaml', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('po2/YamlDictionary', $countTranslations, $countTranslated);
}
public function testPo3()
{
$translations = static::get('po3/input', 'Po');
$countTranslations = 8;
$countTranslated = 8;
$countHeaders = 8;
$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
$this->assertEquals(8, $translations->countTranslated());
$this->assertContent($translations, 'po3/Po');
$this->assertContent($translations, 'po3/Mo');
$this->assertContent($translations, 'po3/PhpArray');
$this->assertContent($translations, 'po3/Jed');
$this->assertContent($translations, 'po3/Json');
$this->assertContent($translations, 'po3/JsonDictionary');
$this->assertContent($translations, 'po3/Csv');
$this->assertContent($translations, 'po3/CsvDictionary');
$this->assertContent($translations, 'po3/Xliff');
$this->assertContent($translations, 'po3/Yaml');
$this->assertContent($translations, 'po3/YamlDictionary');
$this->runTestFormat('po3/Po', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('po3/Mo', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('po3/PhpArray', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('po3/Jed', $countTranslations, $countTranslated, 10);
$this->runTestFormat('po3/Xliff', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('po3/Json', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('po3/JsonDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('po3/Csv', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('po3/CsvDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('po3/Yaml', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('po3/YamlDictionary', $countTranslations, $countTranslated);
}
public function testBlade()
{
$translations = static::get('blade/input', 'Blade');
$countTranslations = 11;
$countTranslated = 0;
$countHeaders = 8;
$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
$this->assertEquals(0, $translations->countTranslated());
$this->assertContent($translations, 'blade/Po');
$this->assertContent($translations, 'blade/Mo');
$this->assertContent($translations, 'blade/PhpArray');
$this->assertContent($translations, 'blade/Jed');
$this->assertContent($translations, 'blade/Json');
$this->assertContent($translations, 'blade/JsonDictionary');
$this->assertContent($translations, 'blade/Csv');
$this->assertContent($translations, 'blade/CsvDictionary');
$this->assertContent($translations, 'blade/Xliff');
$this->assertContent($translations, 'blade/Yaml');
$this->assertContent($translations, 'blade/YamlDictionary');
$this->runTestFormat('blade/Po', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('blade/Mo', 0, $countTranslated, $countHeaders);
$this->runTestFormat('blade/PhpArray', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('blade/Jed', $countTranslations, $countTranslated, 10);
$this->runTestFormat('blade/Xliff', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('blade/Json', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('blade/JsonDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('blade/Csv', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('blade/CsvDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('blade/Yaml', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('blade/YamlDictionary', $countTranslations, $countTranslated);
}
public function testJed()
{
$translations = static::get('jed/input', 'Jed');
$countTranslations = 13;
$countTranslated = 10;
$countHeaders = 10;
$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
$this->assertEquals(10, $translations->countTranslated());
$this->assertContent($translations, 'jed/Po');
$this->assertContent($translations, 'jed/Mo');
$this->assertContent($translations, 'jed/PhpArray');
$this->assertContent($translations, 'jed/Jed');
$this->assertContent($translations, 'jed/Json');
$this->assertContent($translations, 'jed/JsonDictionary');
$this->assertContent($translations, 'jed/Csv');
$this->assertContent($translations, 'jed/CsvDictionary');
$this->assertContent($translations, 'jed/Xliff');
$this->assertContent($translations, 'jed/Yaml');
$this->assertContent($translations, 'jed/YamlDictionary');
$this->runTestFormat('jed/Po', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jed/Mo', 10, $countTranslated, $countHeaders);
$this->runTestFormat('jed/PhpArray', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jed/Jed', $countTranslations, $countTranslated, 10);
$this->runTestFormat('jed/Xliff', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jed/Json', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jed/JsonDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('jed/Csv', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jed/CsvDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('jed/Yaml', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jed/YamlDictionary', $countTranslations, $countTranslated);
}
public function testJsCode()
{
$translations = static::get('jscode/input', 'JsCode');
$countTranslations = 7;
$countTranslated = 0;
$countHeaders = 8;
$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
$this->assertEquals(0, $translations->countTranslated());
$this->assertContent($translations, 'jscode/Po');
$this->assertContent($translations, 'jscode/Mo');
$this->assertContent($translations, 'jscode/PhpArray');
$this->assertContent($translations, 'jscode/Jed');
$this->assertContent($translations, 'jscode/Json');
$this->assertContent($translations, 'jscode/JsonDictionary');
$this->assertContent($translations, 'jscode/Csv');
$this->assertContent($translations, 'jscode/CsvDictionary');
$this->assertContent($translations, 'jscode/Xliff');
$this->assertContent($translations, 'jscode/Yaml');
$this->assertContent($translations, 'jscode/YamlDictionary');
$this->runTestFormat('jscode/Po', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jscode/Mo', 0, $countTranslated, $countHeaders);
$this->runTestFormat('jscode/PhpArray', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jscode/Jed', $countTranslations, $countTranslated, 10);
$this->runTestFormat('jscode/Xliff', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jscode/Json', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jscode/JsonDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('jscode/Csv', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jscode/CsvDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('jscode/Yaml', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jscode/YamlDictionary', $countTranslations, $countTranslated);
}
public function testJs2Code()
{
$translations = static::get('jscode2/input', 'JsCode');
$countTranslations = 4;
$countTranslated = 0;
$countHeaders = 8;
$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
$this->assertEquals(0, $translations->countTranslated());
$this->assertContent($translations, 'jscode2/Po');
$this->assertContent($translations, 'jscode2/Mo');
$this->assertContent($translations, 'jscode2/PhpArray');
$this->assertContent($translations, 'jscode2/Jed');
$this->assertContent($translations, 'jscode2/Json');
$this->assertContent($translations, 'jscode2/JsonDictionary');
$this->assertContent($translations, 'jscode2/Csv');
$this->assertContent($translations, 'jscode2/CsvDictionary');
$this->assertContent($translations, 'jscode2/Xliff');
$this->assertContent($translations, 'jscode2/Yaml');
$this->assertContent($translations, 'jscode2/YamlDictionary');
$this->runTestFormat('jscode2/Po', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jscode2/Mo', 0, $countTranslated, $countHeaders);
$this->runTestFormat('jscode2/PhpArray', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jscode2/Jed', $countTranslations, $countTranslated, 10);
$this->runTestFormat('jscode2/Xliff', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jscode2/Json', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jscode2/JsonDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('jscode2/Csv', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jscode2/CsvDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('jscode2/Yaml', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('jscode2/YamlDictionary', $countTranslations, $countTranslated);
}
public function testPhpCode()
{
$translations = static::get('phpcode/input', 'PhpCode');
$countTranslations = 12;
$countTranslated = 0;
$countHeaders = 8;
$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
$this->assertEquals(0, $translations->countTranslated());
$this->assertContent($translations, 'phpcode/Po');
$this->assertContent($translations, 'phpcode/Mo');
$this->assertContent($translations, 'phpcode/PhpArray');
$this->assertContent($translations, 'phpcode/Jed');
$this->assertContent($translations, 'phpcode/Json');
$this->assertContent($translations, 'phpcode/JsonDictionary');
$this->assertContent($translations, 'phpcode/Csv');
$this->assertContent($translations, 'phpcode/CsvDictionary');
$this->assertContent($translations, 'phpcode/Xliff');
$this->assertContent($translations, 'phpcode/Yaml');
$this->assertContent($translations, 'phpcode/YamlDictionary');
$this->runTestFormat('phpcode/Po', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode/Mo', 0, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode/PhpArray', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode/Jed', $countTranslations, $countTranslated, 10);
$this->runTestFormat('phpcode/Xliff', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode/Json', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode/JsonDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('phpcode/Csv', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode/CsvDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('phpcode/Yaml', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode/YamlDictionary', $countTranslations, $countTranslated);
}
public function testPhpCode2()
{
$translations = static::get('phpcode2/input', 'PhpCode', [
'constants' => [
'CONTEXT' => 'my-context',
],
]);
$countTranslations = 14;
$countTranslated = 0;
$countHeaders = 8;
$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
$this->assertEquals($countTranslated, $translations->countTranslated());
$this->assertContent($translations, 'phpcode2/Po');
$this->assertContent($translations, 'phpcode2/Mo');
$this->assertContent($translations, 'phpcode2/PhpArray');
$this->assertContent($translations, 'phpcode2/Jed');
$this->assertContent($translations, 'phpcode2/Json');
$this->assertContent($translations, 'phpcode2/JsonDictionary');
$this->assertContent($translations, 'phpcode2/Csv');
$this->assertContent($translations, 'phpcode2/CsvDictionary');
$this->assertContent($translations, 'phpcode2/Xliff');
$this->assertContent($translations, 'phpcode2/Yaml');
$this->assertContent($translations, 'phpcode2/YamlDictionary');
$this->runTestFormat('phpcode2/Po', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode2/Mo', 0, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode2/PhpArray', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode2/Jed', $countTranslations, $countTranslated, 10);
$this->runTestFormat('phpcode2/Xliff', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode2/Json', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode2/JsonDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('phpcode2/Csv', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode2/CsvDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('phpcode2/Yaml', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode2/YamlDictionary', $countTranslations, $countTranslated);
}
public function testPhpCode3()
{
$translations = static::get('phpcode3/input', 'PhpCode', [
'extractComments' => ['allowed1', 'allowed2'],
]);
$countTranslations = 2;
$countTranslated = 0;
$countHeaders = 8;
$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
$this->assertEquals(0, $translations->countTranslated());
$this->assertContent($translations, 'phpcode3/Po');
$this->assertContent($translations, 'phpcode3/Mo');
$this->assertContent($translations, 'phpcode3/PhpArray');
$this->assertContent($translations, 'phpcode3/Jed');
$this->assertContent($translations, 'phpcode3/Json');
$this->assertContent($translations, 'phpcode3/JsonDictionary');
$this->assertContent($translations, 'phpcode3/Csv');
$this->assertContent($translations, 'phpcode3/CsvDictionary');
$this->assertContent($translations, 'phpcode3/Xliff');
$this->assertContent($translations, 'phpcode3/Yaml');
$this->assertContent($translations, 'phpcode3/YamlDictionary');
$this->runTestFormat('phpcode3/Po', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode3/Mo', 0, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode3/PhpArray', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode3/Jed', $countTranslations, $countTranslated, 10);
$this->runTestFormat('phpcode3/Xliff', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode3/Json', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode3/JsonDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('phpcode3/Csv', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode3/CsvDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('phpcode3/Yaml', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode3/YamlDictionary', $countTranslations, $countTranslated);
}
public function testTwig()
{
$translations = static::get('twig/input', 'Twig');
$countTranslations = 10;
$countTranslated = 0;
$countHeaders = 8;
$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
$this->assertEquals(0, $translations->countTranslated());
//Ignored in php5 because the line numbers doesn't match due different version of twig
if (PHP_MAJOR_VERSION >= 7) {
$this->assertContent($translations, 'twig/Po');
$this->assertContent($translations, 'twig/Xliff');
}
$this->assertContent($translations, 'twig/Mo');
$this->assertContent($translations, 'twig/PhpArray');
$this->assertContent($translations, 'twig/Jed');
$this->assertContent($translations, 'twig/Json');
$this->assertContent($translations, 'twig/JsonDictionary');
$this->assertContent($translations, 'twig/Csv');
$this->assertContent($translations, 'twig/CsvDictionary');
$this->assertContent($translations, 'twig/Yaml');
$this->assertContent($translations, 'twig/YamlDictionary');
$this->runTestFormat('twig/Po', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('twig/Mo', 0, $countTranslated, $countHeaders);
$this->runTestFormat('twig/PhpArray', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('twig/Jed', $countTranslations, $countTranslated, 10);
$this->runTestFormat('twig/Xliff', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('twig/Json', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('twig/JsonDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('twig/Csv', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('twig/CsvDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('twig/Yaml', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('twig/YamlDictionary', $countTranslations, $countTranslated);
}
public function testVueJs()
{
$translations = static::get('vuejs/input', 'VueJs');
$countTranslations = 34;
$countTranslated = 0;
$countHeaders = 8;
$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
$this->assertEquals(0, $translations->countTranslated());
$this->assertContent($translations, 'vuejs/Po');
$this->assertContent($translations, 'vuejs/Mo');
$this->assertContent($translations, 'vuejs/PhpArray');
$this->assertContent($translations, 'vuejs/Jed');
$this->assertContent($translations, 'vuejs/Json');
$this->assertContent($translations, 'vuejs/JsonDictionary');
$this->assertContent($translations, 'vuejs/Csv');
$this->assertContent($translations, 'vuejs/CsvDictionary');
$this->assertContent($translations, 'vuejs/Xliff');
$this->assertContent($translations, 'vuejs/Yaml');
$this->assertContent($translations, 'vuejs/YamlDictionary');
$this->runTestFormat('vuejs/Po', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('vuejs/Mo', 0, $countTranslated, $countHeaders);
$this->runTestFormat('vuejs/PhpArray', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('vuejs/Jed', $countTranslations, $countTranslated, 10);
$this->runTestFormat('vuejs/Xliff', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('vuejs/Json', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('vuejs/JsonDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('vuejs/Csv', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('vuejs/CsvDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('vuejs/Yaml', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('vuejs/YamlDictionary', $countTranslations, $countTranslated);
}
/**
* Test specific domain translation extraction excluding default domain messages
*/
public function testPhpCode4()
{
$translations = new Translations;
$translations->setDomain('domain1');
PhpCode::fromFile(static::asset('phpcode4/input.php'), $translations, [
'domainOnly' => true,
]);
$countHeaders = 9;
$countTranslated = 0;
$countTranslations = 4;
$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
$this->assertEquals(0, $translations->countTranslated());
$this->assertContent($translations, 'phpcode4/Po');
$this->assertContent($translations, 'phpcode4/Mo');
$this->assertContent($translations, 'phpcode4/PhpArray');
$this->assertContent($translations, 'phpcode4/Jed');
$this->assertContent($translations, 'phpcode4/Json');
$this->assertContent($translations, 'phpcode4/JsonDictionary');
$this->assertContent($translations, 'phpcode4/Csv');
$this->assertContent($translations, 'phpcode4/CsvDictionary');
$this->assertContent($translations, 'phpcode4/Xliff');
$this->assertContent($translations, 'phpcode4/Yaml');
$this->assertContent($translations, 'phpcode4/YamlDictionary');
$this->runTestFormat('phpcode4/Po', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode4/Mo', 0, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode4/PhpArray', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode4/Jed', $countTranslations, $countTranslated, 10);
$this->runTestFormat('phpcode4/Xliff', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode4/Json', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode4/JsonDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('phpcode4/Csv', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode4/CsvDictionary', $countTranslations, $countTranslated);
$this->runTestFormat('phpcode4/Yaml', $countTranslations, $countTranslated, $countHeaders);
$this->runTestFormat('phpcode4/YamlDictionary', $countTranslations, $countTranslated);
}
}