You are here

public function CckSelectOtherTestBase::getRandomOption in CCK Select Other 8

Gets a random option in a list of options.

Parameters

array $options: An array of list options.

Return value

array An indexed array of the key and value.

4 calls to CckSelectOtherTestBase::getRandomOption()
CckSelectOtherDefaultValueTest::testDefaultValue in tests/src/Functional/CckSelectOtherDefaultValueTest.php
Asserts that default value is selected.
CckSelectOtherFieldTypeTest::testField in tests/src/Functional/CckSelectOtherFieldTypeTest.php
Asserts that a user can save regular and other field values.
CckSelectOtherMultipleFieldTest::testMultipleFields in tests/src/Functional/CckSelectOtherMultipleFieldTest.php
Asserts that field one and field two have unique values.
CckSelectOtherMultipleValueTest::testMultipleValues in tests/src/Functional/CckSelectOtherMultipleValueTest.php
Test field validation for required attribute.

File

tests/src/Functional/CckSelectOtherTestBase.php, line 129

Class

CckSelectOtherTestBase
CCK Select Other functional test base class.

Namespace

Drupal\Tests\cck_select_other\Functional

Code

public function getRandomOption(array $options) {
  $option = array_rand($options);
  return [
    $option,
    $options[$option],
  ];
}