MOBILE-3523: Use $WWWROOT to get moodle site url in tests

main
Noel De Martin 2020-09-03 11:42:45 +02:00
parent b5c9ff7aca
commit 20b0afcade
2 changed files with 6 additions and 10 deletions

View File

@ -21,7 +21,7 @@ Feature: Test basic usage of login in app
Scenario: Add a new site in the app & Site name in displayed when adding a new site
When I enter the app
And I press the back button in the app
And I set the field "https://campus.example.edu" to "$WEBSERVER" in the app
And I set the field "https://campus.example.edu" to "$WWWROOT" in the app
And I press "Connect to your site" in the app
Then I should see "Acceptance test site"

View File

@ -98,20 +98,16 @@ class behat_local_moodlemobileapp extends behat_base {
}
/**
* Replaces $WEBSERVER for webserver env variable value, defaults to "webserver" if it is not set.
* Replaces $WWWROOT for the url of the Moodle site.
*
* @Transform /^(.*\$WEBSERVER.*)$/
* @Transform /^(.*\$WWWROOT.*)$/
* @param string $text Text.
* @return string
*/
public function arg_replace_webserver_env($text) {
$webserver = getenv('WEBSERVER');
public function arg_replace_wwwroot($text) {
global $CFG;
if ($webserver === false) {
$webserver = 'webserver';
}
return str_replace('$WEBSERVER', $webserver, $text);
return str_replace('$WWWROOT', $CFG->behat_wwwroot, $text);
}
}