You are here

public function YamlFormOptionsHelperTest::testRange in YAML Form 8

Tests YamlFormOptionsHelper::range().

@dataProvider providerRange

Parameters

array $element: The array to run through YamlFormOptionsHelper::range().

string $expected: The expected result from calling the function.

See also

YamlFormOptionsHelperl::range()

File

tests/src/Unit/YamlFormOptionsHelperTest.php, line 115

Class

YamlFormOptionsHelperTest
Tests form options utility.

Namespace

Drupal\Tests\yamlform\Unit

Code

public function testRange(array $element, $expected) {
  $element += [
    '#min' => 1,
    '#max' => 100,
    '#step' => 1,
    '#pad_length' => NULL,
    '#pad_str' => 0,
  ];
  $result = YamlFormOptionsHelper::range($element['#min'], $element['#max'], $element['#step'], $element['#pad_length'], $element['#pad_str']);
  $this
    ->assertEquals($expected, $result);
}