Skip to content

Commit 4422171

Browse files
committed
Support new directory structure.
Address MDL-83424
1 parent 5ff3912 commit 4422171

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,15 @@ to see more about `docker-compose` environment variables.
6868

6969
## Use containers for running behat tests
7070

71+
> Note: If using tool with versions of Moodle 5.0 and earlier, `public/` command prefix is not required.
72+
7173
```bash
7274
# Initialize behat environment
73-
bin/moodle-docker-compose exec webserver php admin/tool/behat/cli/init.php
75+
bin/moodle-docker-compose exec webserver php public/admin/tool/behat/cli/init.php
7476
# [..]
7577

7678
# Run behat tests
77-
bin/moodle-docker-compose exec -u www-data webserver php admin/tool/behat/cli/run.php --tags=@auth_manual
79+
bin/moodle-docker-compose exec -u www-data webserver php public/admin/tool/behat/cli/run.php --tags=@auth_manual
7880
Running single behat site:
7981
Moodle 3.4dev (Build: 20171006), 33a3ec7c9378e64c6f15c688a3c68a39114aa29d
8082
Php: 7.1.9, pgsql: 9.6.5, OS: Linux 4.9.49-moby x86_64
@@ -95,9 +97,11 @@ Notes:
9597

9698
## Use containers for running phpunit tests
9799

100+
> Note: If using tool with versions of Moodle 5.0 and earlier, `public/` command prefix is not required.
101+
98102
```bash
99103
# Initialize phpunit environment
100-
bin/moodle-docker-compose exec webserver php admin/tool/phpunit/cli/init.php
104+
bin/moodle-docker-compose exec webserver php public/admin/tool/phpunit/cli/init.php
101105
# [..]
102106

103107
# Run phpunit tests
@@ -118,7 +122,7 @@ Notes:
118122
* If you want to run tests with code coverage reports:
119123
```
120124
# Build component configuration
121-
bin/moodle-docker-compose exec webserver php admin/tool/phpunit/cli/util.php --buildcomponentconfigs
125+
bin/moodle-docker-compose exec webserver php public/admin/tool/phpunit/cli/util.php --buildcomponentconfigs
122126
# Execute tests for component
123127
bin/moodle-docker-compose exec webserver php -d pcov.enabled=1 -d pcov.directory=. vendor/bin/phpunit --configuration reportbuilder --coverage-text
124128
```
@@ -128,11 +132,11 @@ bin/moodle-docker-compose exec webserver php -d pcov.enabled=1 -d pcov.directory
128132

129133
```bash
130134
# Initialize Moodle database for manual testing
131-
bin/moodle-docker-compose exec webserver php admin/cli/install_database.php --agree-license --fullname="Docker moodle" --shortname="docker_moodle" --summary="Docker moodle site" --adminpass="test" --adminemail="[email protected]"
135+
bin/moodle-docker-compose exec webserver php public/admin/cli/install_database.php --agree-license --fullname="Docker moodle" --shortname="docker_moodle" --summary="Docker moodle site" --adminpass="test" --adminemail="[email protected]"
132136
```
133137

134138
Notes:
135-
* Moodle is configured to listen on `http://localhost:8000/`.
139+
* Moodle is configured to listen on `http://localhost:8000/public`.
136140
* Mailpit is listening on `http://localhost:8000/_/mail` to view emails which Moodle has sent out.
137141
* The admin `username` you need to use for logging in is `admin` by default. You can customize it by passing `--adminuser='myusername'`
138142
* During manual testing, if you are facing that your Moodle site is logging
@@ -157,11 +161,11 @@ For both options, you also need to set `MOODLE_DOCKER_BROWSER` to "chrome".
157161
git clone https://github.com/moodlehq/moodle-local_moodleappbehat "$MOODLE_DOCKER_WWWROOT/local/moodleappbehat"
158162

159163
# Initialize behat environment
160-
bin/moodle-docker-compose exec webserver php admin/tool/behat/cli/init.php
164+
bin/moodle-docker-compose exec webserver php public/admin/tool/behat/cli/init.php
161165
# (you should see "Configured app tests for version X.X.X" here)
162166

163167
# Run behat tests
164-
bin/moodle-docker-compose exec -u www-data webserver php admin/tool/behat/cli/run.php --tags="@app&&@mod_login"
168+
bin/moodle-docker-compose exec -u www-data webserver php public/admin/tool/behat/cli/run.php --tags="@app&&@mod_login"
165169
Running single behat site:
166170
Moodle 4.0dev (Build: 20200615), a2b286ce176fbe361f0889abc8f30f043cd664ae
167171
Php: 7.2.30, pgsql: 11.8 (Debian 11.8-1.pgdg90+1), OS: Linux 5.3.0-61-generic x86_64

config.docker-template.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
$CFG->wwwroot .= ":{$port}";
4747
}
4848
}
49+
if (file_exists(__DIR__ . '/public')) {
50+
// New Moodle 5.1 public directory structure compatibility.
51+
$CFG->wwwroot .= '/public';
52+
}
4953
}
5054

5155
$CFG->dataroot = '/var/www/moodledata';
@@ -71,6 +75,11 @@
7175
define('TEST_EXTERNAL_FILES_HTTPS_URL', 'http://exttests:9000');
7276

7377
$CFG->behat_wwwroot = 'http://webserver';
78+
if (file_exists(__DIR__ . '/public')) {
79+
// New Moodle 5.1 public directory structure compatibility.
80+
$CFG->behat_wwwroot .= '/public';
81+
}
82+
7483
$CFG->behat_dataroot = '/var/www/behatdata';
7584
$CFG->behat_prefix = 'b_';
7685
$CFG->behat_profiles = array(

0 commit comments

Comments
 (0)