You are here

public function FormStateValuesTraitTest::testGetValue 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::testGetValue()

@covers ::getValue

@dataProvider providerGetValue

File

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

Class

FormStateValuesTraitTest
@coversDefaultClass \Drupal\Core\Form\FormStateValuesTrait

Namespace

Drupal\Tests\Core\Form

Code

public function testGetValue($key, $expected, $default = NULL) {
  $form_state = (new FormStateValuesTraitStub())
    ->setValues([
    'foo' => 'one',
    'bar' => [
      'baz' => 'two',
    ],
  ]);
  $this
    ->assertSame($expected, $form_state
    ->getValue($key, $default));
}