diff --git a/tests/app-setup.sh b/tests/app-setup.sh index e384171f5d4..8d09be819b9 100755 --- a/tests/app-setup.sh +++ b/tests/app-setup.sh @@ -15,12 +15,19 @@ export MOODLE_DOCKER_DB=pgsql initcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_BEHAT_CLI_ROOT}/init.php" +if [ -d "$basedir/moodle/public" ]; +then + MOODLE_PUBLIC_ROOT="$basedir/moodle/public" +else + MOODLE_PUBLIC_ROOT="$basedir/moodle" +fi + if [ "$SUITE" = "app-development" ]; then export MOODLE_DOCKER_APP_PATH="${basedir}/app" git clone --branch "$MOODLE_DOCKER_APP_VERSION" --depth 1 https://github.com/moodlehq/moodleapp $basedir/app - git clone --branch "$MOODLE_DOCKER_APP_VERSION" --depth 1 https://github.com/moodlehq/moodle-local_moodleappbehat $basedir/moodle/local/moodleappbehat + git clone --branch "$MOODLE_DOCKER_APP_VERSION" --depth 1 https://github.com/moodlehq/moodle-local_moodleappbehat ${MOODLE_PUBLIC_ROOT}/local/moodleappbehat if [[ ! -f $basedir/app/.npmrc || -z "$(cat $basedir/app/.npmrc | grep unsafe-perm)" ]]; then @@ -43,13 +50,14 @@ then branch="v$branch" fi - git clone --branch "$branch" --depth 1 https://github.com/moodlehq/moodle-local_moodleappbehat $basedir/moodle/local/moodleappbehat + git clone --branch "$branch" --depth 1 https://github.com/moodlehq/moodle-local_moodleappbehat ${MOODLE_PUBLIC_ROOT}/local/moodleappbehat + else echo "Error, unknown suite '$SUITE'" exit 1 fi -cp $basedir/assets/appbehattests/app.feature $basedir/moodle/local/moodleappbehat/tests/behat/app.feature +cp $basedir/assets/appbehattests/app.feature ${MOODLE_PUBLIC_ROOT}/local/moodleappbehat/tests/behat/app.feature echo "Pulling docker images" $basedir/bin/moodle-docker-compose pull diff --git a/tests/phpunit-teardown.sh b/tests/phpunit-teardown.sh index 134e03aa70f..9296583a0d0 100755 --- a/tests/phpunit-teardown.sh +++ b/tests/phpunit-teardown.sh @@ -4,7 +4,14 @@ basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )" export MOODLE_DOCKER_WWWROOT="${basedir}/moodle" -rm -f $basedir/moodle/local/moodleappbehat/tests/behat/app.feature +if [ -d "$MOODLE_DOCKER_WWWROOT/public" ]; +then + MOODLE_PUBLIC_ROOT="$MOODLE_DOCKER_WWWROOT/public" +else + MOODLE_PUBLIC_ROOT="$MOODLE_DOCKER_WWWROOT" +fi + +rm -f ${MOODLE_PUBLIC_ROOT}/local/moodleappbehat/tests/behat/app.feature if [ "$SUITE" = "phpunit" ]; then