Merge pull request #12 from moodlehq/MOBILE-3523

MOBILE-3523: Use $WWWROOT to get moodle site url in tests
main
Noel De Martin 2020-09-03 11:44:44 +02:00 committed by GitHub
commit 0350ef7182
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 Scenario: Add a new site in the app & Site name in displayed when adding a new site
When I enter the app When I enter the app
And I press the back button in 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 And I press "Connect to your site" in the app
Then I should see "Acceptance test site" 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. * @param string $text Text.
* @return string * @return string
*/ */
public function arg_replace_webserver_env($text) { public function arg_replace_wwwroot($text) {
$webserver = getenv('WEBSERVER'); global $CFG;
if ($webserver === false) { return str_replace('$WWWROOT', $CFG->behat_wwwroot, $text);
$webserver = 'webserver';
}
return str_replace('$WEBSERVER', $webserver, $text);
} }
} }