diff --git a/enrol/tests/behat/behat_enrol.php b/enrol/tests/behat/behat_enrol.php index a549e8c44b3..fee9adc03f6 100644 --- a/enrol/tests/behat/behat_enrol.php +++ b/enrol/tests/behat/behat_enrol.php @@ -39,41 +39,6 @@ use Behat\Gherkin\Node\TableNode as TableNode; */ 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 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. * diff --git a/enrol/upgrade.txt b/enrol/upgrade.txt index 7f915ccf196..cc7d5eb806a 100644 --- a/enrol/upgrade.txt +++ b/enrol/upgrade.txt @@ -6,6 +6,7 @@ information provided here is intended especially for developers. * Final deprecation of the following webservice: * core_enrol_edit_user_enrolment * 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 === diff --git a/lib/tests/behat/behat_deprecated.php b/lib/tests/behat/behat_deprecated.php index c54e5f70457..49009d0e482 100644 --- a/lib/tests/behat/behat_deprecated.php +++ b/lib/tests/behat/behat_deprecated.php @@ -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::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 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')); + } }