[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/behat/ -> behat_field_manager.php (summary)

Form fields helper.

Copyright: 2013 David Monllaó
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 293 lines (11 kb)
Included or required: 4 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

behat_field_manager:: (8 methods):
  get_form_field_from_label()
  get_form_field()
  get_field_instance()
  guess_field_type()
  is_moodleform_field()
  get_field_node_type()
  get_field()
  get_node_type()


Class: behat_field_manager  - X-Ref

Helper to interact with form fields.

get_form_field_from_label($label, RawMinkContext $context)   X-Ref
Gets an instance of the form field from it's label

param: string $label
param: RawMinkContext $context
return: behat_form_field

get_form_field(NodeElement $fieldnode, Session $session)   X-Ref
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.

param: NodeElement $fieldnode
param: Session $session The behat browser session
return: behat_form_field

get_field_instance($type, NodeElement $fieldnode, Session $session)   X-Ref
Returns the appropiate behat_form_field according to the provided type.

It defaults to behat_form_field.

param: string $type The field type (checkbox, date_selector, text...)
param: NodeElement $fieldnode
param: Session $session The behat session
return: behat_form_field

guess_field_type(NodeElement $fieldnode, Session $session)   X-Ref
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.

param: NodeElement $fieldnode
param: Session $session
return: string|bool The field type or false.

is_moodleform_field(NodeElement $fieldnode)   X-Ref
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.

param: NodeElement $fieldnode
return: bool

get_field_node_type(NodeElement $fieldnode, Session $session)   X-Ref
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.

param: NodeElement $fieldnode The current node.
param: Session $session The behat browser session
return: mixed A NodeElement if we continue looking for the element type and String or false when we are done.

get_field(NodeElement $fieldnode, $locator, Session $session)   X-Ref
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.

param: NodeElement $fieldnode
param: string $locator
param: Session $session The behat browser session
return: behat_form_field

get_node_type(NodeElement $fieldnode, $locator, Session $session)   X-Ref
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.

param: NodeElement $fieldnode The current node.
param: string $locator
param: Session $session The behat browser session
return: mixed A NodeElement if we continue looking for the element type and String or false when we are done.



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1