You are here

public function InlineTest::getTestsForParseWithMapObjects in Lockr 7.3

File

vendor/symfony/yaml/Tests/InlineTest.php, line 455

Class

InlineTest

Namespace

Symfony\Component\Yaml\Tests

Code

public function getTestsForParseWithMapObjects() {
  return [
    [
      '',
      '',
    ],
    [
      'null',
      null,
    ],
    [
      'false',
      false,
    ],
    [
      'true',
      true,
    ],
    [
      '12',
      12,
    ],
    [
      '-12',
      -12,
    ],
    [
      '"quoted string"',
      'quoted string',
    ],
    [
      "'quoted string'",
      'quoted string',
    ],
    [
      '12.30e+02',
      1230.0,
    ],
    [
      '0x4D2',
      0x4d2,
    ],
    [
      '02333',
      02333,
    ],
    [
      '.Inf',
      -log(0),
    ],
    [
      '-.Inf',
      log(0),
    ],
    [
      "'686e444'",
      '686e444',
    ],
    [
      '686e444',
      \INF,
    ],
    [
      '123456789123456789123456789123456789',
      '123456789123456789123456789123456789',
    ],
    [
      '"foo\\r\\nbar"',
      "foo\r\nbar",
    ],
    [
      "'foo#bar'",
      'foo#bar',
    ],
    [
      "'foo # bar'",
      'foo # bar',
    ],
    [
      "'#cfcfcf'",
      '#cfcfcf',
    ],
    [
      '::form_base.html.twig',
      '::form_base.html.twig',
    ],
    [
      '2007-10-30',
      gmmktime(0, 0, 0, 10, 30, 2007),
    ],
    [
      '2007-10-30T02:59:43Z',
      gmmktime(2, 59, 43, 10, 30, 2007),
    ],
    [
      '2007-10-30 02:59:43 Z',
      gmmktime(2, 59, 43, 10, 30, 2007),
    ],
    [
      '1960-10-30 02:59:43 Z',
      gmmktime(2, 59, 43, 10, 30, 1960),
    ],
    [
      '1730-10-30T02:59:43Z',
      gmmktime(2, 59, 43, 10, 30, 1730),
    ],
    [
      '"a \\"string\\" with \'quoted strings inside\'"',
      'a "string" with \'quoted strings inside\'',
    ],
    [
      "'a \"string\" with ''quoted strings inside'''",
      'a "string" with \'quoted strings inside\'',
    ],
    // sequences
    // urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon
    [
      '[foo, http://urls.are/no/mappings, false, null, 12]',
      [
        'foo',
        'http://urls.are/no/mappings',
        false,
        null,
        12,
      ],
    ],
    [
      '[  foo  ,   bar , false  ,  null     ,  12  ]',
      [
        'foo',
        'bar',
        false,
        null,
        12,
      ],
    ],
    [
      '[\'foo,bar\', \'foo bar\']',
      [
        'foo,bar',
        'foo bar',
      ],
    ],
    // mappings
    [
      '{foo: bar,bar: foo,"false": false,"null": null,integer: 12}',
      (object) [
        'foo' => 'bar',
        'bar' => 'foo',
        'false' => false,
        'null' => null,
        'integer' => 12,
      ],
      Yaml::PARSE_OBJECT_FOR_MAP,
    ],
    [
      '{ foo  : bar, bar : foo,  "false"  :   false,  "null"  :   null,  integer :  12  }',
      (object) [
        'foo' => 'bar',
        'bar' => 'foo',
        'false' => false,
        'null' => null,
        'integer' => 12,
      ],
      Yaml::PARSE_OBJECT_FOR_MAP,
    ],
    [
      '{foo: \'bar\', bar: \'foo: bar\'}',
      (object) [
        'foo' => 'bar',
        'bar' => 'foo: bar',
      ],
    ],
    [
      '{\'foo\': \'bar\', "bar": \'foo: bar\'}',
      (object) [
        'foo' => 'bar',
        'bar' => 'foo: bar',
      ],
    ],
    [
      '{\'foo\'\'\': \'bar\', "bar\\"": \'foo: bar\'}',
      (object) [
        'foo\'' => 'bar',
        'bar"' => 'foo: bar',
      ],
    ],
    [
      '{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}',
      (object) [
        'foo: ' => 'bar',
        'bar: ' => 'foo: bar',
      ],
    ],
    [
      '{"foo:bar": "baz"}',
      (object) [
        'foo:bar' => 'baz',
      ],
    ],
    [
      '{"foo":"bar"}',
      (object) [
        'foo' => 'bar',
      ],
    ],
    // nested sequences and mappings
    [
      '[foo, [bar, foo]]',
      [
        'foo',
        [
          'bar',
          'foo',
        ],
      ],
    ],
    [
      '[foo, {bar: foo}]',
      [
        'foo',
        (object) [
          'bar' => 'foo',
        ],
      ],
    ],
    [
      '{ foo: {bar: foo} }',
      (object) [
        'foo' => (object) [
          'bar' => 'foo',
        ],
      ],
    ],
    [
      '{ foo: [bar, foo] }',
      (object) [
        'foo' => [
          'bar',
          'foo',
        ],
      ],
    ],
    [
      '[  foo, [  bar, foo  ]  ]',
      [
        'foo',
        [
          'bar',
          'foo',
        ],
      ],
    ],
    [
      '[{ foo: {bar: foo} }]',
      [
        (object) [
          'foo' => (object) [
            'bar' => 'foo',
          ],
        ],
      ],
    ],
    [
      '[foo, [bar, [foo, [bar, foo]], foo]]',
      [
        'foo',
        [
          'bar',
          [
            'foo',
            [
              'bar',
              'foo',
            ],
          ],
          'foo',
        ],
      ],
    ],
    [
      '[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]',
      [
        'foo',
        (object) [
          'bar' => 'foo',
          'foo' => [
            'foo',
            (object) [
              'bar' => 'foo',
            ],
          ],
        ],
        [
          'foo',
          (object) [
            'bar' => 'foo',
          ],
        ],
      ],
    ],
    [
      '[foo, bar: { foo: bar }]',
      [
        'foo',
        '1' => (object) [
          'bar' => (object) [
            'foo' => 'bar',
          ],
        ],
      ],
    ],
    [
      '[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']',
      [
        'foo',
        '@foo.baz',
        (object) [
          '%foo%' => 'foo is %foo%',
          'bar' => '%foo%',
        ],
        true,
        '@service_container',
      ],
    ],
    [
      '{}',
      new \stdClass(),
    ],
    [
      '{ foo  : bar, bar : {}  }',
      (object) [
        'foo' => 'bar',
        'bar' => new \stdClass(),
      ],
    ],
    [
      '{ foo  : [], bar : {}  }',
      (object) [
        'foo' => [],
        'bar' => new \stdClass(),
      ],
    ],
    [
      '{foo: \'bar\', bar: {} }',
      (object) [
        'foo' => 'bar',
        'bar' => new \stdClass(),
      ],
    ],
    [
      '{\'foo\': \'bar\', "bar": {}}',
      (object) [
        'foo' => 'bar',
        'bar' => new \stdClass(),
      ],
    ],
    [
      '{\'foo\': \'bar\', "bar": \'{}\'}',
      (object) [
        'foo' => 'bar',
        'bar' => '{}',
      ],
    ],
    [
      '[foo, [{}, {}]]',
      [
        'foo',
        [
          new \stdClass(),
          new \stdClass(),
        ],
      ],
    ],
    [
      '[foo, [[], {}]]',
      [
        'foo',
        [
          [],
          new \stdClass(),
        ],
      ],
    ],
    [
      '[foo, [[{}, {}], {}]]',
      [
        'foo',
        [
          [
            new \stdClass(),
            new \stdClass(),
          ],
          new \stdClass(),
        ],
      ],
    ],
    [
      '[foo, {bar: {}}]',
      [
        'foo',
        '1' => (object) [
          'bar' => new \stdClass(),
        ],
      ],
    ],
  ];
}