function NumberItemTest::dataTestMinMaxValue

Same name and namespace in other branches
  1. 10 core/modules/field/tests/src/Kernel/Number/NumberItemTest.php \Drupal\Tests\field\Kernel\Number\NumberItemTest::dataTestMinMaxValue()

Data provider for testFormFieldMinMaxValue().

Return value

\Generator The test data.

File

core/modules/field/tests/src/Kernel/Number/NumberItemTest.php, line 246

Class

NumberItemTest
Tests the new entity API for the number field type.

Namespace

Drupal\Tests\field\Kernel\Number

Code

public static function dataTestMinMaxValue() {
  (yield [
    1,
    10,
    5,
    FALSE,
    '',
  ]);
  (yield [
    10,
    5,
    6,
    TRUE,
    'The minimum value must be less than or equal to 5.',
  ]);
  (yield [
    1,
    0,
    6,
    TRUE,
    'The minimum value must be less than or equal to 0.',
  ]);
  (yield [
    0,
    -2,
    0.5,
    TRUE,
    'The minimum value must be less than or equal to -2.',
  ]);
  (yield [
    -10,
    -20,
    -5,
    TRUE,
    'The minimum value must be less than or equal to -20.',
  ]);
  (yield [
    1,
    '',
    -5,
    FALSE,
    '',
  ]);
  (yield [
    '',
    '',
    '',
    FALSE,
    '',
  ]);
  (yield [
    '2',
    '1',
    '',
    TRUE,
    'The minimum value must be less than or equal to 1.',
  ]);
}

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