function FormStateValuesTraitTest::providerHasValue

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

Provides data to self::testHasValue().

Return value

array[] Items are arrays of two items:

  • The key to check for in the form state (string)
  • Whether the form state has an item with that key (bool).

File

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

Class

FormStateValuesTraitTest
@coversDefaultClass \Drupal\Core\Form\FormStateValuesTrait

Namespace

Drupal\Tests\Core\Form

Code

public static function providerHasValue() {
    $data = [];
    $data[] = [
        'foo',
        TRUE,
    ];
    $data[] = [
        [
            'bar',
            'baz',
        ],
        TRUE,
    ];
    $data[] = [
        [
            'foo',
            'bar',
            'baz',
        ],
        FALSE,
    ];
    $data[] = [
        'true',
        TRUE,
    ];
    $data[] = [
        'false',
        TRUE,
    ];
    $data[] = [
        'null',
        FALSE,
    ];
    return $data;
}

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