Helper to interact with form fields.
More...
|
static | get_field_instance ($type, NodeElement $fieldnode, Session $session) |
| Returns the appropiate behat_form_field according to the provided type.
|
|
static | get_form_field (NodeElement $fieldnode, Session $session) |
| Gets an instance of the form field.
|
|
static | get_form_field_from_label ($label, RawMinkContext $context) |
| Gets an instance of the form field from it's label.
|
|
static | guess_field_type (NodeElement $fieldnode, Session $session) |
| Guesses a basic field type and returns it.
|
|
|
static | get_dom_elements_for_node (NodeElement $fieldnode, Session $session) |
| Get the DOMDocument and DOMElement for a NodeElement.
|
|
static | get_field_node_type (NodeElement $fieldnode, Session $session) |
| Recursive method to find the field type.
|
|
static | get_field_type (\DOMDocument $document, DOMElement $node, Session $session) |
| Get the field type from the specified DOMElement.
|
|
static | is_moodleform_field (NodeElement $fieldnode) |
| Detects when the field is a moodleform field type.
|
|
static | normalise_fieldtype (string $fieldtype) |
| Normalise the field type.
|
|
Helper to interact with form fields.
- Copyright
- 2013 David MonllaĆ³
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- Copyright
- 2013 David MonllaĆ³
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ get_dom_elements_for_node()
static behat_field_manager::get_dom_elements_for_node |
( |
NodeElement | $fieldnode, |
|
|
Session | $session ) |
|
staticprotected |
Get the DOMDocument and DOMElement for a NodeElement.
- Parameters
-
NodeElement | $fieldnode | |
Session | $session | |
- Return values
-
◆ get_field_instance()
static behat_field_manager::get_field_instance |
( |
| $type, |
|
|
NodeElement | $fieldnode, |
|
|
Session | $session ) |
|
static |
Returns the appropiate behat_form_field according to the provided type.
It defaults to behat_form_field.
- Parameters
-
string | $type | The field type (checkbox, date_selector, text...) |
NodeElement | $fieldnode | |
Session | $session | The behat session |
- Return values
-
◆ get_field_node_type()
static behat_field_manager::get_field_node_type |
( |
NodeElement | $fieldnode, |
|
|
Session | $session ) |
|
staticprotected |
Recursive method to find the field type.
Depending on the field the felement class node is in a level or in another. We look recursively for a parent node with a 'felement' class to find the field type.
- Parameters
-
NodeElement | $fieldnode | The current node. |
Session | $session | The behat browser session |
- Return values
-
null|string | A text description of the node type, or null if one could not be accurately determined |
◆ get_field_type()
static behat_field_manager::get_field_type |
( |
\DOMDocument | $document, |
|
|
DOMElement | $node, |
|
|
Session | $session ) |
|
staticprotected |
Get the field type from the specified DOMElement.
- Parameters
-
DOMDocument | $document | |
DOMElement | $node | |
Session | $session | |
- Return values
-
◆ get_form_field()
static behat_field_manager::get_form_field |
( |
NodeElement | $fieldnode, |
|
|
Session | $session ) |
|
static |
Gets an instance of the form field.
Not all the fields are part of a moodle form, in this cases it fallsback to the generic form field. Also note that this generic field type is using a generic setValue() method from the Behat API, which is not always good to set the value of form elements.
- Parameters
-
NodeElement | $fieldnode | |
Session | $session | The behat browser session |
- Return values
-
◆ get_form_field_from_label()
static behat_field_manager::get_form_field_from_label |
( |
| $label, |
|
|
RawMinkContext | $context ) |
|
static |
Gets an instance of the form field from it's label.
- Parameters
-
string | $label | |
RawMinkContext | $context | |
- Return values
-
◆ guess_field_type()
static behat_field_manager::guess_field_type |
( |
NodeElement | $fieldnode, |
|
|
Session | $session ) |
|
static |
Guesses a basic field type and returns it.
This method is intended to detect HTML form fields when no moodleform-specific elements have been detected.
- Parameters
-
NodeElement | $fieldnode | |
Session | $session | |
- Return values
-
string|bool | The field type or false. |
◆ is_moodleform_field()
static behat_field_manager::is_moodleform_field |
( |
NodeElement | $fieldnode | ) |
|
|
staticprotected |
Detects when the field is a moodleform field type.
Note that there are fields inside moodleforms that are not moodleform element; this method can not detect this, this will be managed by get_field_node_type, after failing to find the form element element type.
- Parameters
-
- Return values
-
◆ normalise_fieldtype()
static behat_field_manager::normalise_fieldtype |
( |
string | $fieldtype | ) |
|
|
staticprotected |
Normalise the field type.
- Parameters
-
- Return values
-
The documentation for this class was generated from the following file:
- lib/behat/behat_field_manager.php