Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Single select form field class.

Copyright: 2012 David MonllaĆ³
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 202 lines (7 kb)
Included or required: 3 times
Referenced: 0 times
Includes or requires: 1 file
 lib/behat/form_field/behat_form_field.php

Defines 1 class

behat_form_select:: (6 methods):
  set_value()
  get_value()
  matches()
  get_unescaped_options()
  get_selected_options()
  get_option_xpath()


Class: behat_form_select  - X-Ref

Single select form field.

set_value($value)   X-Ref
Sets the value(s) of a select element.

Seems an easy select, but there are lots of combinations
of browsers and operative systems and each one manages the
autosubmits and the multiple option selects in a different way.

param: string $value plain value or comma separated values if multiple. Commas in values escaped with backslash.
return: void

get_value()   X-Ref
Returns the text of the currently selected options.

return: string Comma separated if multiple options are selected. Commas in option texts escaped with backslash.

matches($expectedvalue)   X-Ref
Returns whether the provided argument matches the current value.

param: mixed $expectedvalue
return: bool

get_unescaped_options($value)   X-Ref
Cleans the list of options and returns it as a string separating options with |||.

param: string $value The string containing the escaped options.
return: string The options

get_selected_options($returntexts = true)   X-Ref
Returns the field selected values.

Externalized from the common behat_form_field API method get_value() as
matches() needs to check against both values and texts.

param: bool $returntexts Returns the options texts or the options values.
return: string

get_option_xpath($option, $selectxpath)   X-Ref
Returns the opton XPath based on it's select xpath.

param: string $option
param: string $selectxpath
return: string xpath