You are here

public function FormStateTest::testHasValue 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::testHasValue()

@covers ::hasValue

@dataProvider providerTestHasValue

File

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

Class

FormStateTest
@coversDefaultClass \Drupal\Core\Form\FormState

Namespace

Drupal\Tests\Core\Form

Code

public function testHasValue($key, $expected) {
  $form_state = (new FormState())
    ->setValues([
    'foo' => 'one',
    'bar' => array(
      'baz' => 'two',
    ),
    'true' => TRUE,
    'false' => FALSE,
    'null' => NULL,
  ]);
  $this
    ->assertSame($expected, $form_state
    ->hasValue($key));
}