You are here

public function NumberItemTest::dataNumberFieldSettingsProvider in Drupal 10

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

Data provider for testConstraints.

Return value

\Generator The test data.

File

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

Class

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

Namespace

Drupal\Tests\field\Kernel\Number

Code

public function dataNumberFieldSettingsProvider() {
  (yield [
    'integer',
    NULL,
    NULL,
    -100,
    FALSE,
  ]);
  (yield [
    'integer',
    0,
    NULL,
    -100,
    TRUE,
    '<em class="placeholder">field_integer</em>: the value may be no less than <em class="placeholder">0</em>.',
  ]);
  (yield [
    'integer',
    10,
    NULL,
    100,
    FALSE,
  ]);
  (yield [
    'integer',
    10,
    NULL,
    5,
    TRUE,
    '<em class="placeholder">field_integer</em>: the value may be no less than <em class="placeholder">10</em>.',
  ]);
  (yield [
    'integer',
    10,
    20,
    25,
    TRUE,
    '<em class="placeholder">field_integer</em>: the value may be no greater than <em class="placeholder">20</em>.',
  ]);
  (yield [
    'integer',
    10,
    20,
    15,
    FALSE,
  ]);
  (yield [
    'float',
    NULL,
    NULL,
    -100,
    FALSE,
  ]);
  (yield [
    'float',
    0.003,
    NULL,
    0.0029,
    TRUE,
    '<em class="placeholder">field_float</em>: the value may be no less than <em class="placeholder">0.003</em>.',
  ]);
  (yield [
    'float',
    10.05,
    NULL,
    13.4,
    FALSE,
  ]);
  (yield [
    'float',
    10,
    NULL,
    9.999000000000001,
    TRUE,
    '<em class="placeholder">field_float</em>: the value may be no less than <em class="placeholder">10</em>.',
  ]);
  (yield [
    'float',
    1,
    2,
    2.5,
    TRUE,
    '<em class="placeholder">field_float</em>: the value may be no greater than <em class="placeholder">2</em>.',
  ]);
  (yield [
    'float',
    1,
    2,
    1.5,
    FALSE,
  ]);
  (yield [
    'decimal',
    NULL,
    NULL,
    -100,
    FALSE,
  ]);
  (yield [
    'decimal',
    0.001,
    NULL,
    -0.05,
    TRUE,
    '<em class="placeholder">field_decimal</em>: the value may be no less than <em class="placeholder">0.001</em>.',
  ]);
  (yield [
    'decimal',
    10.05,
    NULL,
    13.4,
    FALSE,
  ]);
  (yield [
    'decimal',
    10,
    NULL,
    9.999000000000001,
    TRUE,
    '<em class="placeholder">field_decimal</em>: the value may be no less than <em class="placeholder">10</em>.',
  ]);
  (yield [
    'decimal',
    1,
    2,
    2.5,
    TRUE,
    '<em class="placeholder">field_decimal</em>: the value may be no greater than <em class="placeholder">2</em>.',
  ]);
  (yield [
    'decimal',
    1,
    2,
    1.5,
    FALSE,
  ]);
}