You are here

public function XliffFileLoaderTest::testEncoding in Plug 7

File

lib/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'));
}