Skip to content

Commit

Permalink
MDL-75456 behat: final deprecation of get_node_type() and get_field()
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze committed Aug 15, 2022
1 parent 896e126 commit 7abd77f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 36 deletions.
41 changes: 6 additions & 35 deletions lib/behat/behat_field_manager.php
Expand Up @@ -336,47 +336,18 @@ protected static function normalise_fieldtype(string $fieldtype): string {
}

/**
* 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.
*
* @deprecated since Moodle 2.6 MDL-39634 - please do not use this function any more.
* @todo MDL-XXXXX This will be deleted in Moodle 2.8
* @see behat_field_manager::get_form_field()
* @param NodeElement $fieldnode
* @param string $locator
* @param Session $session The behat browser session
* @return behat_form_field
*/
public static function get_field(NodeElement $fieldnode, $locator, Session $session) {
debugging('Function behat_field_manager::get_field() is deprecated, ' .
'please use function behat_field_manager::get_form_field() instead', DEBUG_DEVELOPER);

return self::get_form_field($fieldnode, $session);
public static function get_field() {
throw new coding_exception('behat_field_manager::get_field() can not be used any more, ' .
'function behat_field_manager::get_form_field() instead');
}

/**
* 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.
*
* @deprecated since Moodle 2.6 MDL-39634 - please do not use this function any more.
* @todo MDL-XXXXX This will be deleted in Moodle 2.8
* @see behat_field_manager::get_field_node_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.
*/
protected static function get_node_type(NodeElement $fieldnode, $locator, Session $session) {
debugging('Function behat_field_manager::get_node_type() is deprecated, ' .
'please use function behat_field_manager::get_field_node_type() instead', DEBUG_DEVELOPER);

return self::get_field_node_type($fieldnode, $session);
protected static function get_node_type() {
throw new coding_exception('behat_field_manager::get_node_type() can not be used any more, ' .
'function behat_field_manager::get_field_node_type() instead');
}
}
3 changes: 2 additions & 1 deletion lib/upgrade.txt
Expand Up @@ -2,7 +2,8 @@ This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.

=== 4.1 ===

* Final deprecation of the following functions behat_field_manager::get_node_type() and behat_field_manager::get_field()
please call behat_field_manager::get_field_node_type() and behat_field_manager::get_form_field().
* Final deprecation and removal of the following class, please use \core\task\manager.
- \tool_task\run_from_cli
* Final deprecation and removal of the following CLI scripts:
Expand Down

0 comments on commit 7abd77f

Please sign in to comment.