function FormStateValuesTraitTest::providerSetValue

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php \Drupal\Tests\Core\Form\FormStateValuesTraitTest::providerSetValue()
  2. 10 core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php \Drupal\Tests\Core\Form\FormStateValuesTraitTest::providerSetValue()
  3. 11.x 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 131

Class

FormStateValuesTraitTest
@coversDefaultClass \Drupal\Core\Form\FormStateValuesTrait

Namespace

Drupal\Tests\Core\Form

Code

public 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.