You are here

public function FormStateValuesTraitTest::providerSetValue in Drupal 9

Same name and namespace in other branches
  1. 8 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()

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;
}