function YamlTestBase::providerEncodeDecodeTests

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

Some data that should be able to be serialized.

File

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

Class

YamlTestBase
Provides standard data to validate different YAML implementations.

Namespace

Drupal\Tests\Component\Serialization

Code

public static function providerEncodeDecodeTests() {
    return [
        [
            'data' => [
                'foo' => 'bar',
                'id' => 'schnitzel',
                'ponies' => [
                    'nope',
                    'thanks',
                ],
                'how' => [
                    'about' => 'if',
                    'i' => 'ask',
                    'nicely',
                ],
                'the' => [
                    'answer' => [
                        'still' => 'would',
                        'be' => 'Y',
                    ],
                ],
                'how_many_times' => 123,
                'should_i_ask' => FALSE,
                1,
                FALSE,
                [
                    1,
                    FALSE,
                ],
                [
                    10,
                ],
                [
                    0 => '123456',
                ],
            ],
        ],
        [
            'data' => [
                NULL,
            ],
        ],
    ];
}

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