Commit 05a6bca7 authored by Adrian Greeve's avatar Adrian Greeve
Browse files

MDL-72090 behat: Deprecation of enrolment behat step.

i_add_enrolment_method_with() is now deprecated, please use
i_add_enrolment_method_for_with() instead.
parent fcd4de86
...@@ -39,41 +39,6 @@ use Behat\Gherkin\Node\TableNode as TableNode; ...@@ -39,41 +39,6 @@ use Behat\Gherkin\Node\TableNode as TableNode;
*/ */
class behat_enrol extends behat_base { class behat_enrol extends behat_base {
/**
* Adds the specified enrolment method to the current course filling the form with the provided data.
*
* @Given /^I add "(?P<enrolment_method_name_string>(?:[^"]|\\")*)" enrolment method with:$/
* @param string $enrolmethod
* @param TableNode $table
*/
public function i_add_enrolment_method_with($enrolmethod, TableNode $table) {
// Navigate to enrolment method page.
$parentnodes = get_string('users', 'admin');
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration",
array($parentnodes .' > '. get_string('type_enrol_plural', 'plugin'))
);
// Select enrolment method.
$this->execute('behat_forms::i_select_from_the_singleselect',
array($this->escape($enrolmethod), get_string('addinstance', 'enrol'))
);
// Wait again, for page to reloaded.
$this->execute('behat_general::i_wait_to_be_redirected');
// Set form fields.
$this->execute("behat_forms::i_set_the_following_fields_to_these_values", $table);
// Ensure we get button in focus, before pressing button.
if ($this->running_javascript()) {
$this->execute('behat_general::i_press_named_key', ['', 'tab']);
}
// Save changes.
$this->execute("behat_forms::press_button", get_string('addinstance', 'enrol'));
}
/** /**
* Add the specified enrolment method to the specified course filling the form with the provided data. * Add the specified enrolment method to the specified course filling the form with the provided data.
* *
......
...@@ -6,6 +6,7 @@ information provided here is intended especially for developers. ...@@ -6,6 +6,7 @@ information provided here is intended especially for developers.
* Final deprecation of the following webservice: * Final deprecation of the following webservice:
* core_enrol_edit_user_enrolment * core_enrol_edit_user_enrolment
* External function core_enrol_external::get_users_courses now returns the last time a course was modified (timemodified field) * External function core_enrol_external::get_users_courses now returns the last time a course was modified (timemodified field)
* The behat step i_add_enrolment_method_with() has been deprecated. Please use the new method i_add_enrolment_method_for_with()
=== 3.11 === === 3.11 ===
......
...@@ -148,4 +148,43 @@ class behat_deprecated extends behat_base { ...@@ -148,4 +148,43 @@ class behat_deprecated extends behat_base {
$this->execute("behat_general::i_click_on", array($xpath, "xpath_element")); $this->execute("behat_general::i_click_on", array($xpath, "xpath_element"));
$this->execute("behat_general::wait_until_the_page_is_ready"); $this->execute("behat_general::wait_until_the_page_is_ready");
} }
/**
* Adds the specified enrolment method to the current course filling the form with the provided data.
*
* @Given /^I add "(?P<enrolment_method_name_string>(?:[^"]|\\")*)" enrolment method with:$/
* @param string $enrolmethod
* @param TableNode $table
*
* @deprecated since 4.0 MDL-72090. We now need the course to enrol in. Please use i_add_enrolment_method_for_with()
* @todo MDL-71733 This will be deleted in Moodle 4.4.
*/
public function i_add_enrolment_method_with($enrolmethod, TableNode $table) {
$this->deprecated_message(['i_add_enrolment_method_for_with']);
// Navigate to enrolment method page.
$parentnodes = get_string('users', 'admin');
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration",
array($parentnodes .' > '. get_string('type_enrol_plural', 'plugin'))
);
// Select enrolment method.
$this->execute('behat_forms::i_select_from_the_singleselect',
array($this->escape($enrolmethod), get_string('addinstance', 'enrol'))
);
// Wait again, for page to reloaded.
$this->execute('behat_general::i_wait_to_be_redirected');
// Set form fields.
$this->execute("behat_forms::i_set_the_following_fields_to_these_values", $table);
// Ensure we get button in focus, before pressing button.
if ($this->running_javascript()) {
$this->execute('behat_general::i_press_named_key', ['', 'tab']);
}
// Save changes.
$this->execute("behat_forms::press_button", get_string('addinstance', 'enrol'));
}
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment