You are here

public function WebformOptionsHelperTest::providerGetOptionsText 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::providerGetOptionsText()

Data provider for testGetOptionsText().

See also

testGetOptionsText()

File

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

Class

WebformOptionsHelperTest
Tests webform options utility.

Namespace

Drupal\Tests\webform\Unit\Utility

Code

public function providerGetOptionsText() {
  $tests[] = [
    [
      'value',
    ],
    [
      'value' => 'text',
    ],
    [
      'text',
    ],
  ];
  $tests[] = [
    [
      1,
      3,
    ],
    [
      1 => 'One',
      2 => 'Two',
      'optgroup' => [
        3 => 'Three',
      ],
    ],
    [
      'One',
      'Three',
    ],
  ];
  $tests[] = [
    [
      2,
    ],
    [
      'optgroup1' => [
        1 => 'One',
      ],
      'optgroup2' => [
        2 => 'Two',
      ],
    ],
    [
      'Two',
    ],
  ];
  return $tests;
}