You are here

public function ParserTest::testTabsInYaml in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Symfony/Component/Yaml/Tests/ParserTest.php \Symfony\Component\Yaml\Tests\ParserTest::testTabsInYaml()
  2. 7.2 vendor/Symfony/Component/Yaml/Tests/ParserTest.php \Symfony\Component\Yaml\Tests\ParserTest::testTabsInYaml()

File

vendor/Symfony/Component/Yaml/Tests/ParserTest.php, line 75

Class

ParserTest

Namespace

Symfony\Component\Yaml\Tests

Code

public function testTabsInYaml() {

  // test tabs in YAML
  $yamls = array(
    "foo:\n\tbar",
    "foo:\n \tbar",
    "foo:\n\t bar",
    "foo:\n \t bar",
  );
  foreach ($yamls as $yaml) {
    try {
      $content = $this->parser
        ->parse($yaml);
      $this
        ->fail('YAML files must not contain tabs');
    } catch (\Exception $e) {
      $this
        ->assertInstanceOf('\\Exception', $e, 'YAML files must not contain tabs');
      $this
        ->assertEquals('A YAML file cannot contain tabs as indentation at line 2 (near "' . strpbrk($yaml, "\t") . '").', $e
        ->getMessage(), 'YAML files must not contain tabs');
    }
  }
}