function ConfigTargetTest::providerTestFromFormException

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php \Drupal\Tests\Core\Form\ConfigTargetTest::providerTestFromFormException()

File

core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php, line 167

Class

ConfigTargetTest
@coversDefaultClass \Drupal\Core\Form\ConfigTarget @group Form

Namespace

Drupal\Tests\Core\Form

Code

public static function providerTestFromFormException() : array {
    return [
        'No #config_target' => [
            [
                'test' => [
                    '#type' => 'text',
                    '#default_value' => 'A test',
                ],
            ],
            [
                'test',
            ],
            'The form element [test] does not have the #config_target property set',
        ],
        'No #config_target nested' => [
            [
                'group' => [
                    '#type' => 'details',
                    'test' => [
                        '#type' => 'text',
                        '#default_value' => 'A test',
                    ],
                ],
            ],
            [
                'group',
                'test',
            ],
            'The form element [group][test] does not have the #config_target property set',
        ],
        'Boolean #config_target nested' => [
            [
                'group' => [
                    '#type' => 'details',
                    'test' => [
                        '#type' => 'text',
                        '#config_target' => FALSE,
                        '#default_value' => 'A test',
                    ],
                ],
            ],
            [
                'group',
                'test',
            ],
            'The form element [group][test] #config_target property is not a string or a ConfigTarget object',
        ],
    ];
}

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