You are here

public function WebformOptionsHelperTest::providerRange in Webform 8.5

Same name and namespace in other branches
  1. 6.x tests/src/Unit/Utility/WebformOptionsHelperTest.php \Drupal\Tests\webform\Unit\Utility\WebformOptionsHelperTest::providerRange()

Data provider for testRange().

See also

testRange()

File

tests/src/Unit/Utility/WebformOptionsHelperTest.php, line 146

Class

WebformOptionsHelperTest
Tests webform options utility.

Namespace

Drupal\Tests\webform\Unit\Utility

Code

public function providerRange() {
  $tests[] = [
    [
      '#min' => 1,
      '#max' => 3,
    ],
    [
      1 => 1,
      2 => 2,
      3 => 3,
    ],
  ];
  $tests[] = [
    [
      '#min' => 0,
      '#max' => 6,
      '#step' => 2,
    ],
    [
      0 => 0,
      2 => 2,
      4 => 4,
      6 => 6,
    ],
  ];
  $tests[] = [
    [
      '#min' => 'A',
      '#max' => 'C',
    ],
    [
      'A' => 'A',
      'B' => 'B',
      'C' => 'C',
    ],
  ];
  $tests[] = [
    [
      '#min' => 'a',
      '#max' => 'c',
    ],
    [
      'a' => 'a',
      'b' => 'b',
      'c' => 'c',
    ],
  ];
  $tests[] = [
    [
      '#min' => 1,
      '#max' => 3,
      '#step' => 1,
      '#pad_length' => 2,
      '#pad_str' => 0,
    ],
    [
      '01' => '01',
      '02' => '02',
      '03' => '03',
    ],
  ];
  return $tests;
}