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
|
<?php
namespace Gettext\Tests;
use Gettext\Extractors\PhpCode;
use Gettext\Extractors\VueJs;
use Gettext\Translations;
class AssetsTest extends AbstractTestCase
{
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->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);
}
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->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);
}
public function testPo3()
{
$translations = static::get('po3/input', 'Po');
$countTranslations = 10;
$countTranslated = 10;
$countHeaders = 8;
$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
$this->assertEquals(10, $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->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);
}
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->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);
}
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->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);
}
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->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);
}
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->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);
}
public function testPhpCode2()
{
$translations = static::get('phpcode2/input', 'PhpCode', [
'constants' => [
'CONTEXT' => 'my-context',
],
]);
$countTranslations = 19;
$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->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);
}
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->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);
}
public function testVueJs()
{
$this->markTestSkipped("Skip VueJs tests for Debian package.");
$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->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);
}
/**
* 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->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);
}
public function testPhpCode5MultipleDomainScanning()
{
$tDomainNone = new Translations; // Non-domain strings
$tDomain1 = (new Translations)->setDomain('domain1');
$tDomain2 = (new Translations)->setDomain('domain2');
$tDomain3 = (new Translations)->setDomain('domain3');
$tDomainMissing = (new Translations)->setDomain('domainMissing'); // No translations for this domain
/** @var Translations[] $allTranslations */
$allTranslations = [
'domainNone' => $tDomainNone,
'domain1' => $tDomain1,
'domain2' => $tDomain2,
'domain3' => $tDomain3,
'domainMissing' => $tDomainMissing,
];
PhpCode::fromFileMultiple(static::asset('phpcode5/input.php'), array_values($allTranslations));
foreach ($allTranslations as $file => $translations) {
$this->assertContent($translations, 'phpcode5/' . $file, 'Po');
}
}
public function testVueJs2MultipleDomainScanning()
{
$this->markTestSkipped("Skip VueJs tests for Debian package.");
$tDomainNone = new Translations; // Non-domain strings
$tDomain1 = (new Translations)->setDomain('domain1');
$tDomain2 = (new Translations)->setDomain('domain2');
$tDomainMissing = (new Translations)->setDomain('domainMissing'); // No translations for this domain
/** @var Translations[] $allTranslations */
$allTranslations = [
'domainNone' => $tDomainNone,
'domain1' => $tDomain1,
'domain2' => $tDomain2,
'domainMissing' => $tDomainMissing,
];
VueJs::fromFileMultiple(static::asset('vuejs2/input.vue'), array_values($allTranslations));
foreach ($allTranslations as $file => $translations) {
$this->assertContent($translations, 'vuejs2/' . $file, 'Po');
}
}
public function testMissingDomainScanWithOtherStringsInFile()
{
$translations = (new Translations())->setDomain('unknown-domain');
PhpCode::fromFileMultiple(static::asset('phpcode6/input.php'), [$translations]);
self::assertCount(0, $translations);
}
public function testVueJsUtf8Scanning()
{
$translations = new Translations();
VueJs::fromFile(static::asset('vuejs3/input.vue'), $translations);
self::assertCount(2, $translations);
self::assertNotFalse($translations->find('', 'Let’s test ā ūtf8 štriņģ 😎️'));
self::assertNotFalse($translations->find('', 'We’re happy to have you here, 愛'));
}
public function testXliffUnitIds()
{
$translations = static::get('xliff/Xliff', 'Xliff', ['unitid_as_id' => true]);
$countTranslations = 3;
$countTranslated = 3;
$countHeaders = 9;
$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
$this->assertEquals($countTranslated, $translations->countTranslated());
foreach ($translations as $translation) {
switch (\Gettext\Generators\Xliff::getUnitID($translation)) {
case 'custom.unit.id':
$this->assertEquals($translation->getOriginal(), 'one file');
$this->assertEquals($translation->getTranslation(), '1 plik');
break;
case 'second.custom.unit.id':
$this->assertEquals($translation->getOriginal(), 'one');
$this->assertEquals($translation->getTranslation(), '1');
break;
case 'duplicate.source.unit.id':
$this->assertEquals($translation->getOriginal(), 'one');
$this->assertEquals($translation->getTranslation(), 'uno');
break;
default:
$this->assertFalse(true);
}
}
// Converting from an XLIFF that contains duplicate <source> elements
// to a PO file will result in the loss of the duplicates.
$this->runTestFormat('xliff/Po', $countTranslations - 1, $countTranslated - 1, $countHeaders);
}
}
|