public function ParserTest::testNonUtf8Exception in Service Container 7.2
Same name and namespace in other branches
- 7 modules/providers/service_container_symfony/lib/Symfony/Component/Yaml/Tests/ParserTest.php \Symfony\Component\Yaml\Tests\ParserTest::testNonUtf8Exception()
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ Yaml/ Tests/ ParserTest.php, line 449
Class
Namespace
Symfony\Component\Yaml\TestsCode
public function testNonUtf8Exception() {
if (!function_exists('iconv')) {
$this
->markTestSkipped('Exceptions for non-utf8 charsets require the iconv() function.');
return;
}
$yamls = array(
iconv('UTF-8', 'ISO-8859-1', "foo: 'äöüß'"),
iconv('UTF-8', 'ISO-8859-15', "euro: '€'"),
iconv('UTF-8', 'CP1252', "cp1252: '©ÉÇáñ'"),
);
foreach ($yamls as $yaml) {
try {
$this->parser
->parse($yaml);
$this
->fail('charsets other than UTF-8 are rejected.');
} catch (\Exception $e) {
$this
->assertInstanceOf('Symfony\\Component\\Yaml\\Exception\\ParseException', $e, 'charsets other than UTF-8 are rejected.');
}
}
}