Skip to content

Commit 7f58c45

Browse files
authored
Merge pull request #12 from moodlehq/MOBILE-3523
MOBILE-3523: Use $WWWROOT to get moodle site url in tests
2 parents 2a9b4f2 + 390571e commit 7f58c45

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

mod/login/tests/behat/app_basic_usage.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Feature: Test basic usage of login in app
2121
Scenario: Add a new site in the app & Site name in displayed when adding a new site
2222
When I enter the app
2323
And I press the back button in the app
24-
And I set the field "https://campus.example.edu" to "$WEBSERVER" in the app
24+
And I set the field "https://campus.example.edu" to "$WWWROOT" in the app
2525
And I press "Connect to your site" in the app
2626
Then I should see "Acceptance test site"
2727

tests/behat/behat_local_moodlemobileapp.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,16 @@ function() use ($session) {
9898
}
9999

100100
/**
101-
* Replaces $WEBSERVER for webserver env variable value, defaults to "webserver" if it is not set.
101+
* Replaces $WWWROOT for the url of the Moodle site.
102102
*
103-
* @Transform /^(.*\$WEBSERVER.*)$/
103+
* @Transform /^(.*\$WWWROOT.*)$/
104104
* @param string $text Text.
105105
* @return string
106106
*/
107-
public function arg_replace_webserver_env($text) {
108-
$webserver = getenv('WEBSERVER');
107+
public function arg_replace_wwwroot($text) {
108+
global $CFG;
109109

110-
if ($webserver === false) {
111-
$webserver = 'webserver';
112-
}
113-
114-
return str_replace('$WEBSERVER', $webserver, $text);
110+
return str_replace('$WWWROOT', $CFG->behat_wwwroot, $text);
115111
}
116112

117113
}

0 commit comments

Comments
 (0)