function FormStateValuesTraitTest::providerSetValue

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php \Drupal\Tests\Core\Form\FormStateValuesTraitTest::providerSetValue()
  2. 8.9.x core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php \Drupal\Tests\Core\Form\FormStateValuesTraitTest::providerSetValue()
  3. 10 core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php \Drupal\Tests\Core\Form\FormStateValuesTraitTest::providerSetValue()

Provides data to self::testSetValue().

Return value

array[] Items are arrays of two items:

  • The key for which to set a new value (string)
  • The new value to set (mixed).
  • The expected form state values after setting the new value (mixed[]).

File

core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php, line 133

Class

FormStateValuesTraitTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Form%21FormStateValuesTrait.php/trait/FormStateValuesTrait/11.x" title="Provides methods to manage form state values." class="local">\Drupal\Core\Form\FormStateValuesTrait</a>

Namespace

Drupal\Tests\Core\Form

Code

public static function providerSetValue() {
    $data = [];
    $data[] = [
        'foo',
        'one',
        [
            'bar' => 'wrong',
            'foo' => 'one',
        ],
    ];
    $data[] = [
        [
            'bar',
            'baz',
        ],
        'two',
        [
            'bar' => [
                'baz' => 'two',
            ],
        ],
    ];
    $data[] = [
        [
            'foo',
            'bar',
            'baz',
        ],
        NULL,
        [
            'bar' => 'wrong',
            'foo' => [
                'bar' => [
                    'baz' => NULL,
                ],
            ],
        ],
    ];
    return $data;
}

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