mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-74643 core_user: Added behat page resolver
Currently this supports resolving the Contact Site Support page.
This commit is contained in:
parent
fa7a55aa5d
commit
ddc9a30fa1
@ -84,4 +84,26 @@ class behat_user extends behat_base {
|
||||
throw new ExpectationException('The "' . $field . '" field does have purpose "' . $purpose . '"', $this->getSession());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert page names to URLs for steps like 'When I am on the "[page name]" page'.
|
||||
*
|
||||
* Recognised page names are:
|
||||
* | Page name | Description |
|
||||
* | Contact Site Support | The Contact Site Support page (user/contactsitesupport.php) |
|
||||
*
|
||||
* @param string $page name of the page, with the component name removed e.g. 'Admin notification'.
|
||||
* @return moodle_url the corresponding URL.
|
||||
* @throws Exception with a meaningful error message if the specified page cannot be found.
|
||||
*/
|
||||
protected function resolve_page_url(string $page): moodle_url {
|
||||
|
||||
switch (strtolower($page)) {
|
||||
case 'contact site support':
|
||||
return new moodle_url('/user/contactsitesupport.php');
|
||||
|
||||
default:
|
||||
throw new Exception("Unrecognised core_user page type '{$page}'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user