You are here

public function XliffFileLoaderTest::testEncoding in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php \Symfony\Component\Translation\Tests\Loader\XliffFileLoaderTest::testEncoding()

File

vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php, line 62

Class

XliffFileLoaderTest

Namespace

Symfony\Component\Translation\Tests\Loader

Code

public function testEncoding() {
  if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) {
    $this
      ->markTestSkipped('The iconv and mbstring extensions are not available.');
  }
  $loader = new XliffFileLoader();
  $catalogue = $loader
    ->load(__DIR__ . '/../fixtures/encoding.xlf', 'en', 'domain1');
  $this
    ->assertEquals(utf8_decode('föö'), $catalogue
    ->get('bar', 'domain1'));
  $this
    ->assertEquals(utf8_decode('bär'), $catalogue
    ->get('foo', 'domain1'));
  $this
    ->assertEquals(array(
    'notes' => array(
      array(
        'content' => utf8_decode('bäz'),
      ),
    ),
  ), $catalogue
    ->getMetadata('foo', 'domain1'));
}