MDL-74636 behat: step to skip this scenario if a plugin isn't installed

This commit is contained in:
Tim Hunt
2022-07-29 09:50:56 +01:00
parent d4f3852dd2
commit dd4d110c9b
+15
View File
@@ -1922,6 +1922,21 @@ EOF;
throw new \Moodle\BehatExtension\Exception\SkippedException();
}
/**
* Checks if given plugin is installed, and skips the current scenario if not.
*
* @Given the :plugin plugin is installed
* @param string $plugin frankenstyle plugin name, e.g. 'filter_embedquestion'.
* @throws \Moodle\BehatExtension\Exception\SkippedException
*/
public function plugin_is_installed(string $plugin): void {
$path = core_component::get_component_directory($plugin);
if (!is_readable($path . '/version.php')) {
throw new \Moodle\BehatExtension\Exception\SkippedException(
'Skipping this scenario because the ' . $plugin . ' is not installed.');
}
}
/**
* Checks focus is with the given element.
*