function YamlTestBase::providerDecodeTests

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Serialization/YamlTestBase.php \Drupal\Tests\Component\Serialization\YamlTestBase::providerDecodeTests()
  2. 8.9.x core/tests/Drupal/Tests/Component/Serialization/YamlTestBase.php \Drupal\Tests\Component\Serialization\YamlTestBase::providerDecodeTests()
  3. 10 core/tests/Drupal/Tests/Component/Serialization/YamlTestBase.php \Drupal\Tests\Component\Serialization\YamlTestBase::providerDecodeTests()

Some data that should be able to be deserialized.

File

core/tests/Drupal/Tests/Component/Serialization/YamlTestBase.php, line 53

Class

YamlTestBase
Provides standard data to validate different YAML implementations.

Namespace

Drupal\Tests\Component\Serialization

Code

public static function providerDecodeTests() {
    $data = [
        // NULL files.
[
            '',
            NULL,
        ],
        [
            "\n",
            NULL,
        ],
        [
            "---\n...\n",
            NULL,
        ],
        // Node anchors.
[
            "\njquery.ui:\n  version: &jquery_ui 1.10.2\n\njquery.ui.accordion:\n  version: *jquery_ui\n",
            [
                'jquery.ui' => [
                    'version' => '1.10.2',
                ],
                'jquery.ui.accordion' => [
                    'version' => '1.10.2',
                ],
            ],
        ],
    ];
    // 1.2 Bool values.
    foreach (static::providerBoolTest() as $test) {
        $data[] = [
            'bool: ' . $test[0],
            [
                'bool' => $test[1],
            ],
        ];
    }
    $data = array_merge($data, static::providerBoolTest());
    return $data;
}

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