From a3e810bf7ea31a84aa910c1099e9f4afeb55906f Mon Sep 17 00:00:00 2001 From: ferranrecio Date: Tue, 9 Jul 2024 15:25:54 +0200 Subject: [PATCH] MDL-82424 behat: steps to handle plugins This commit adds one new step to disable plugins, and also replaces the regexp from the enable plugins method to make ti compatible with the tool_generator create testing scenario. --- lib/tests/behat/behat_general.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/tests/behat/behat_general.php b/lib/tests/behat/behat_general.php index 5c48d897103..bd7d7d0a271 100644 --- a/lib/tests/behat/behat_general.php +++ b/lib/tests/behat/behat_general.php @@ -2371,6 +2371,18 @@ EOF; $class::enable_plugin($plugin, true); } + /** + * Disable an specific plugin. + * + * @When /^I disable "(?P(?:[^"]|\\")*)" "(?P[^"]*)" plugin$/ + * @param string $plugin Plugin we look for + * @param string $plugintype The type of the plugin + */ + public function i_disable_plugin($plugin, $plugintype) { + $class = core_plugin_manager::resolve_plugininfo_class($plugintype); + $class::enable_plugin($plugin, false); + } + /** * Set the default text editor to the named text editor. *