Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions tests/behat/behat_auth_saml2.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,26 +379,22 @@ private function reset_moodle_session() {
}

/**
* Execute.
* Helper function to execute api in a given context.
*
* @param string $contextapi context in which api is defined.
* @param array $params list of params to pass.
* Note: The contextapi does not support a callback.
*
* @param string|array $contextapi context in which api is defined.
* @param mixed $params list of params to pass or a single parameter
*/
protected function execute($contextapi, $params = []) {
protected function execute(
string|array $contextapi,
mixed $params = [],
): void {
global $CFG;

// We allow usage of depricated behat steps for now.
$CFG->behat_usedeprecated = true;

// If newer Moodle, use the correct version.
if ($CFG->branch >= 29) {
return parent::execute($contextapi, $params);
}

// Backported for Moodle 27 and 28.
list($class, $method) = explode("::", $contextapi);
$object = behat_context_helper::get($class);
$object->setMinkParameter('base_url', $CFG->wwwroot);
return call_user_func_array([$object, $method], $params);
parent::execute($contextapi, $params);
}
}
Loading