function FormStateValuesTraitTest::testIsValueEmpty

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php \Drupal\Tests\Core\Form\FormStateValuesTraitTest::testIsValueEmpty()
  2. 9 core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php \Drupal\Tests\Core\Form\FormStateValuesTraitTest::testIsValueEmpty()
  3. 8.9.x core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php \Drupal\Tests\Core\Form\FormStateValuesTraitTest::testIsValueEmpty()

Tests is value empty.

@legacy-covers ::isValueEmpty

Attributes

#[DataProvider('providerIsValueEmpty')]

File

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

Class

FormStateValuesTraitTest
Tests Drupal\Core\Form\FormStateValuesTrait.

Namespace

Drupal\Tests\Core\Form

Code

public function testIsValueEmpty($key, $expected) : void {
  $form_state = (new FormStateValuesTraitStub())->setValues([
    'foo' => 'one',
    'bar' => [
      'baz' => 'two',
    ],
    'true' => TRUE,
    'false' => FALSE,
    'null' => NULL,
  ]);
  $this->assertSame($expected, $form_state->isValueEmpty($key));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.