function ConfigTargetTest::providerTestFromFormException

Same name and namespace in other branches
  1. 10 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 <a href="/api/drupal/core%21lib%21Drupal%21Core%21Form%21ConfigTarget.php/class/ConfigTarget/11.x" title="Represents the mapping of a config property to a form element." class="local">\Drupal\Core\Form\ConfigTarget</a> @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.