You are here

private function BrowserKitDriver::getOptionValue in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php \Behat\Mink\Driver\BrowserKitDriver::getOptionValue()

Gets the value of an option element

Parameters

\DOMElement $option:

Return value

string

See also

\Symfony\Component\DomCrawler\Field\ChoiceFormField::buildOptionValue

2 calls to BrowserKitDriver::getOptionValue()
BrowserKitDriver::getValue in vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php
Returns element's value by it's XPath query.
BrowserKitDriver::isSelected in vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php
Checks whether select option, located by it's XPath query, is selected.

File

vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php, line 761

Class

BrowserKitDriver
Symfony2 BrowserKit driver.

Namespace

Behat\Mink\Driver

Code

private function getOptionValue(\DOMElement $option) {
  if ($option
    ->hasAttribute('value')) {
    return $option
      ->getAttribute('value');
  }
  if (!empty($option->nodeValue)) {
    return $option->nodeValue;
  }
  return '1';

  // DomCrawler uses 1 by default if there is no text in the option
}