-
Bug
-
Resolution: Fixed
-
Minor
-
4.0
-
MOODLE_400_STABLE
-
MOODLE_400_STABLE
-
MDL-73669-master -
In 3.11 we deprecated some behat steps in our plugins by creating files:
admin/tool/wp/tests/behat/behat_tool_wp_deprecated.php
class behat_tool_wp_deprecated extends behat_deprecated {
|
/**
|
* Click on the form button in the modal form.
|
*
|
* @When /^I press "(?P<button_string>(?:[^"]|\\")*)" in the modal form dialogue$/
|
* @param string $buttontext
|
*
|
* @deprecated Since 3.11. Please use {@see behat_general::i_click_on_in_the}
|
*/
|
public function i_press_in_the_modal_form_dialogue($buttontext) {
|
$this->deprecated_message(
|
'Use instead: And I click on "BUTTONNAME "button" in the "DIALOGUENAME" "dialogue"');
|
|
// I click on "Save changes" "button" in the ".modal.show .modal-footer" "css_element" .
|
$this->execute('behat_general::i_click_on_in_the', [$this->escape($buttontext), 'button',
|
'.modal.show .modal-footer', 'css_element']);
|
}
|
|
}
|
The similar deprecation would be in other plugins, for example
admin/tool/certification/tests/behat/behat_tool_certification_deprecated.php
class behat_tool_certification_deprecated extends behat_deprecated {
|
// ...
|
}
|
This worked fine until we upgraded to 4.0
Now every step throws an exception:
005 Scenario: Testing workplace launcher in list format # /var/www/html/theme/workplace/tests/behat/steps.feature:13
|
And I log out # /var/www/html/theme/workplace/tests/behat/steps.feature:19
|
Step "/^I select "(?P<link_string>(?:[^"]|\\")*)" from flat navigation drawer$/" is already defined in behat_tool_certification_deprecated::i_select_from_flat_navigation_drawer()
|
|
behat_tool_certification_deprecated::i_select_from_flat_navigation_drawer()
|
behat_tool_wp_deprecated::i_select_from_flat_navigation_drawer()
|
Neither behat_tool_certification_deprecated nor behat_tool_wp_deprecated contain this step, it is defined in behat_deprecated.
I am not sure what changed in 4.0 so it no longer works. These classes can not extend behat_base because the function
$this->deprecated_message(...);
|
will not be available there.
Edit: this is not a new problem in 4.0, we only hit it now because there were no deprecated steps in behat_deprecated.php (in core) in 3.11 . So we were probably doing it incorrect anyway but the question remains - what is the recommended way to deprecate steps in PLUGINS