You are here

public function DurationFieldBrowserTestBase::selectSelectOption in Duration Field 3.0.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/DurationFieldBrowserTestBase.php \Drupal\Tests\duration_field\Functional\DurationFieldBrowserTestBase::selectSelectOption()
  2. 8 tests/src/Functional/DurationFieldBrowserTestBase.php \Drupal\Tests\duration_field\Functional\DurationFieldBrowserTestBase::selectSelectOption()

Selects an option from a select element.

3 calls to DurationFieldBrowserTestBase::selectSelectOption()
DurationFieldFunctionalTest::createDefaultSetup in tests/src/Functional/DurationFieldFunctionalTest.php
Sets up a date.
DurationFieldFunctionalTest::setFormatter in tests/src/Functional/DurationFieldFunctionalTest.php
Sets the formatter to be tested.
DurationFieldFunctionalTest::setHumanReadableOptions in tests/src/Functional/DurationFieldFunctionalTest.php
Sets some human readable options.

File

tests/src/Functional/DurationFieldBrowserTestBase.php, line 116

Class

DurationFieldBrowserTestBase
Base class that provides some helper functions for functional tests.

Namespace

Drupal\Tests\duration_field\Functional

Code

public function selectSelectOption($selectElementHtmlID, $value) {
  if (preg_match('/^#/', $selectElementHtmlID)) {
    $selectElementHtmlID = substr($selectElementHtmlID, 1);
  }
  $this
    ->getSession()
    ->getDriver()
    ->selectOption('//select[@id="' . $selectElementHtmlID . '"]', $value);
}