You are here

public function FormStateTest::testSetValue in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Form/FormStateTest.php \Drupal\Tests\Core\Form\FormStateTest::testSetValue()

@covers ::setValue

@dataProvider providerTestSetValue

File

core/tests/Drupal/Tests/Core/Form/FormStateTest.php, line 206
Contains \Drupal\Tests\Core\Form\FormStateTest.

Class

FormStateTest
@coversDefaultClass \Drupal\Core\Form\FormState

Namespace

Drupal\Tests\Core\Form

Code

public function testSetValue($key, $value, $expected) {
  $form_state = (new FormState())
    ->setValues([
    'bar' => 'wrong',
  ]);
  $form_state
    ->setValue($key, $value);
  $this
    ->assertSame($expected, $form_state
    ->getValues());
}