Skip to content

Commit

Permalink
MDL-74636 behat: step to skip this scenario if a plugin isn't installed
Browse files Browse the repository at this point in the history
  • Loading branch information
timhunt committed Jul 29, 2022
1 parent a866652 commit 241b662
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/tests/behat/behat_general.php
Expand Up @@ -1988,6 +1988,21 @@ public function database_family_used_is_one_of_the_following(TableNode $database
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.
*
Expand Down

0 comments on commit 241b662

Please sign in to comment.