diff --git a/asystgrade/tests/quiz_api_test.php b/asystgrade/tests/quiz_api_test.php index cc9427093dc1fd86a70bcda958e8a27cfc5cc329..e2cfb6597575243705661cebcdc4828e0a92b958 100755 --- a/asystgrade/tests/quiz_api_test.php +++ b/asystgrade/tests/quiz_api_test.php @@ -325,7 +325,7 @@ class quiz_api_test extends advanced_testcase $question_attempt_step_id = $DB->insert_record('question_attempt_steps', $question_attempt_step); // Example of how to shorten the answer length - $answer_length = strlen($exapmle_answers) - ($student_id * strlen($exapmle_answers) / 6); // Reduce the answer by 10 characters for each subsequent student + $answer_length = strlen($exapmle_answers) - (int) ($student_id * strlen($exapmle_answers) / 6); // Reduce the answer by 10 characters for each subsequent student $student_answer = substr($exapmle_answers, 0, $answer_length); // Saving the answer text diff --git a/install_moodle.sh b/install_moodle.sh index 0f68f2f81e368b8def490aad82f49a093185e3ad..bfc4a9716da0333477bef4a7e204ad2387a968a8 100755 --- a/install_moodle.sh +++ b/install_moodle.sh @@ -47,19 +47,17 @@ docker-compose exec moodle php ${MOODLE_BASE_DIR}/admin/cli/install.php \ echo "No database backup found. Skipping restore." fi +# Locale setting inside the Docker container +docker-compose exec -u root moodle bash -c "apt-get update && apt-get install -y locales && \ + echo 'en_AU.UTF-8 UTF-8' >> /etc/locale.gen && \ + locale-gen && \ + update-locale" + # Composer installation to run phpunit tests docker-compose exec moodle php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" docker-compose exec moodle php composer-setup.php --install-dir=/usr/local/bin --filename=composer docker-compose exec moodle php -r "unlink('composer-setup.php');" - docker-compose exec moodle php composer install --no-interaction \ - --no-plugins \ - --no-scripts \ - --no-dev \ - --prefer-dist && composer dump-autoload - -docker-compose exec moodle apt-get update && apt-get install -y locales && \ - echo "en_AU.UTF-8 UTF-8" >> /etc/locale.gen && \ - locale-gen + docker-compose exec moodle bash -c "cd /app && /usr/local/bin/composer install --no-interaction --no-plugins --no-scripts --no-dev --prefer-dist && /usr/local/bin/composer dump-autoload" # Next, configure PHPUnit for Moodle: docker-compose exec moodle php admin/tool/phpunit/cli/init.php