public function WebformOptionsHelperTest::testRange in Webform 6.x
Same name and namespace in other branches
- 8.5 tests/src/Unit/Utility/WebformOptionsHelperTest.php \Drupal\Tests\webform\Unit\Utility\WebformOptionsHelperTest::testRange()
Tests WebformOptionsHelper::range().
@dataProvider providerRange
Parameters
array $element: The array to run through WebformOptionsHelper::range().
string $expected: The expected result from calling the function.
See also
File
- tests/
src/ Unit/ Utility/ WebformOptionsHelperTest.php, line 122
Class
- WebformOptionsHelperTest
- Tests webform options utility.
Namespace
Drupal\Tests\webform\Unit\UtilityCode
public function testRange(array $element, $expected) {
$element += [
'#min' => 1,
'#max' => 100,
'#step' => 1,
'#pad_length' => NULL,
'#pad_str' => 0,
];
$result = WebformOptionsHelper::range($element['#min'], $element['#max'], $element['#step'], $element['#pad_length'], $element['#pad_str']);
$this
->assertEquals($expected, $result);
}