You are here

public function ParserTest::testNonUtf8Exception in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php \Symfony\Component\Yaml\Tests\ParserTest::testNonUtf8Exception()

@requires extension iconv

File

vendor/symfony/yaml/Tests/ParserTest.php, line 563

Class

ParserTest

Namespace

Symfony\Component\Yaml\Tests

Code

public function testNonUtf8Exception() {
  $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.');
    }
  }
}