You are here

public function ParserTest::indentedMappingData in Lockr 7.3

File

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

Class

ParserTest

Namespace

Symfony\Component\Yaml\Tests

Code

public function indentedMappingData() {
  $tests = [];
  $yaml = <<<YAML
foo:
  - bar: "foobar"
    # A comment
    baz: "foobaz"
YAML;
  $expected = [
    'foo' => [
      [
        'bar' => 'foobar',
        'baz' => 'foobaz',
      ],
    ],
  ];
  $tests['comment line is first line in indented block'] = [
    $yaml,
    $expected,
  ];
  $yaml = <<<YAML
foo:
    - bar:
        # comment
        baz: [1, 2, 3]
YAML;
  $expected = [
    'foo' => [
      [
        'bar' => [
          'baz' => [
            1,
            2,
            3,
          ],
        ],
      ],
    ],
  ];
  $tests['mapping value on new line starting with a comment line'] = [
    $yaml,
    $expected,
  ];
  $yaml = <<<YAML
foo:
  -
    bar: foobar
YAML;
  $expected = [
    'foo' => [
      [
        'bar' => 'foobar',
      ],
    ],
  ];
  $tests['mapping in sequence starting on a new line'] = [
    $yaml,
    $expected,
  ];
  $yaml = <<<YAML
foo:

    bar: baz
YAML;
  $expected = [
    'foo' => [
      'bar' => 'baz',
    ],
  ];
  $tests['blank line at the beginning of an indented mapping value'] = [
    $yaml,
    $expected,
  ];
  return $tests;
}