function YamlSymfonyTest::taggedValuesProvider

Data provider for testCustomTagSupport().

Return value

array A list of test data.

File

core/tests/Drupal/Tests/Component/Serialization/YamlSymfonyTest.php, line 133

Class

YamlSymfonyTest
Tests the YamlSymfony serialization implementation.

Namespace

Drupal\Tests\Component\Serialization

Code

public function taggedValuesProvider() {
  return [
    'sequences' => [
      [
        new TaggedValue('foo', [
          'yaml',
        ]),
        new TaggedValue('quz', [
          'bar',
        ]),
      ],
      <<<YAML
      - !foo
          - yaml
      - !quz [bar]
      YAML,
    ],
    'mappings' => [
      new TaggedValue('foo', [
        'foo' => new TaggedValue('quz', [
          'bar',
        ]),
        'quz' => new TaggedValue('foo', [
          'quz' => 'bar',
        ]),
      ]),
      <<<YAML
      !foo
      foo: !quz [bar]
      quz: !foo
         quz: bar
      YAML,
    ],
    'inline' => [
      [
        new TaggedValue('foo', [
          'foo',
          'bar',
        ]),
        new TaggedValue('quz', [
          'foo' => 'bar',
          'quz' => new TaggedValue('bar', [
            'one' => 'bar',
          ]),
        ]),
      ],
      <<<YAML
      - !foo [foo, bar]
      - !quz {foo: bar, quz: !bar {one: bar}}
      YAML,
    ],
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.