From b9bd8344650cc8f2cd4ef2f3181f109528818109 Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Mon, 17 Mar 2025 10:26:23 -0400 Subject: [PATCH 01/21] naively add main to test matrix --- .github/workflows/moodle-plugin-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moodle-plugin-ci.yml b/.github/workflows/moodle-plugin-ci.yml index 5aebd95e7..7f887a1c7 100644 --- a/.github/workflows/moodle-plugin-ci.yml +++ b/.github/workflows/moodle-plugin-ci.yml @@ -31,7 +31,7 @@ jobs: fail-fast: false matrix: php: ['8.1', '8.2', '8.3'] - moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE', 'MOODLE_405_STABLE'] + moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE', 'MOODLE_405_STABLE', 'main'] database: [pgsql, mariadb] exclude: - php: '8.2' From a99e22105203982bda890997cdcfd8500edf96ec Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Tue, 18 Mar 2025 11:35:58 -0400 Subject: [PATCH 02/21] try wip v5 plugin --- .github/workflows/moodle-plugin-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moodle-plugin-ci.yml b/.github/workflows/moodle-plugin-ci.yml index 7f887a1c7..c4badbd86 100644 --- a/.github/workflows/moodle-plugin-ci.yml +++ b/.github/workflows/moodle-plugin-ci.yml @@ -61,7 +61,7 @@ jobs: - name: Initialise moodle-plugin-ci run: | - composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4 + composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^dev-wip_v5 echo $(cd ci/bin; pwd) >> $GITHUB_PATH echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH sudo locale-gen en_AU.UTF-8 From 5f1a69a11aab1c9c796b512d5c8f0fccec434077 Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Tue, 18 Mar 2025 11:37:58 -0400 Subject: [PATCH 03/21] try diff version string --- .github/workflows/moodle-plugin-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moodle-plugin-ci.yml b/.github/workflows/moodle-plugin-ci.yml index c4badbd86..9fe3724b0 100644 --- a/.github/workflows/moodle-plugin-ci.yml +++ b/.github/workflows/moodle-plugin-ci.yml @@ -61,7 +61,7 @@ jobs: - name: Initialise moodle-plugin-ci run: | - composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^dev-wip_v5 + composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci dev-wip_v5 echo $(cd ci/bin; pwd) >> $GITHUB_PATH echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH sudo locale-gen en_AU.UTF-8 From 8ec8e738db5d63c23f37ffb3b4f13e7be8314b8b Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Tue, 18 Mar 2025 11:40:37 -0400 Subject: [PATCH 04/21] try dev-main --- .github/workflows/moodle-plugin-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moodle-plugin-ci.yml b/.github/workflows/moodle-plugin-ci.yml index 9fe3724b0..1ecd4e884 100644 --- a/.github/workflows/moodle-plugin-ci.yml +++ b/.github/workflows/moodle-plugin-ci.yml @@ -61,7 +61,7 @@ jobs: - name: Initialise moodle-plugin-ci run: | - composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci dev-wip_v5 + composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci dev-main echo $(cd ci/bin; pwd) >> $GITHUB_PATH echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH sudo locale-gen en_AU.UTF-8 From 995e9b68c0e6f5dc90c364be08d3b723b53846e9 Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Tue, 18 Mar 2025 11:50:22 -0400 Subject: [PATCH 05/21] try 8.4 --- .github/workflows/moodle-plugin-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moodle-plugin-ci.yml b/.github/workflows/moodle-plugin-ci.yml index 1ecd4e884..e14873cca 100644 --- a/.github/workflows/moodle-plugin-ci.yml +++ b/.github/workflows/moodle-plugin-ci.yml @@ -30,7 +30,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.1', '8.2', '8.3'] + php: ['8.1', '8.2', '8.3', '8.4'] moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE', 'MOODLE_405_STABLE', 'main'] database: [pgsql, mariadb] exclude: From 25df37199390dc2159ec03e94da0ca31628753ac Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Tue, 18 Mar 2025 11:56:23 -0400 Subject: [PATCH 06/21] Revert "try 8.4" This reverts commit 995e9b68c0e6f5dc90c364be08d3b723b53846e9. --- .github/workflows/moodle-plugin-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moodle-plugin-ci.yml b/.github/workflows/moodle-plugin-ci.yml index e14873cca..1ecd4e884 100644 --- a/.github/workflows/moodle-plugin-ci.yml +++ b/.github/workflows/moodle-plugin-ci.yml @@ -30,7 +30,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.1', '8.2', '8.3', '8.4'] + php: ['8.1', '8.2', '8.3'] moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE', 'MOODLE_405_STABLE', 'main'] database: [pgsql, mariadb] exclude: From 9872dd47a2037a543757df8ed359437d3c435fef Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Tue, 18 Mar 2025 14:09:53 -0400 Subject: [PATCH 07/21] fix class in user forfeited badge test --- .../user_forfeited_badge/user_forfeited_badge_test.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/core/badge_revoked/user_forfeited_badge/user_forfeited_badge_test.php b/tests/core/badge_revoked/user_forfeited_badge/user_forfeited_badge_test.php index 86c328eeb..70509741c 100644 --- a/tests/core/badge_revoked/user_forfeited_badge/user_forfeited_badge_test.php +++ b/tests/core/badge_revoked/user_forfeited_badge/user_forfeited_badge_test.php @@ -23,13 +23,13 @@ require_once($CFG->dirroot . '/admin/tool/log/store/xapi/tests/xapi_test_case.php'); /** - * Unit test for mod_quiz attempt submitted (multichoice set with choices) event. + * Unit test for user forfeited badge event. * * @package logstore_xapi * @copyright Daniel Bell * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class user_achieved_badge_test extends \logstore_xapi\xapi_test_case { +class user_forfeited_badge_test extends \logstore_xapi\xapi_test_case { /** * Retrieve the directory of the unit test. @@ -48,7 +48,7 @@ protected function get_test_dir() { protected function get_plugin_type() { return "core"; } - + /** * Retrieve the plugin name being tested. * From 5514fa6c5a8a765a2899959320db68f5ef7e8e5a Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Tue, 18 Mar 2025 14:10:57 -0400 Subject: [PATCH 08/21] correct test name --- .../existing_course_resources_list_viewed_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/core/course_resources_list_viewed/existing_course_resources_list_viewed/existing_course_resources_list_viewed_test.php b/tests/core/course_resources_list_viewed/existing_course_resources_list_viewed/existing_course_resources_list_viewed_test.php index be72fc474..d7b66a67b 100644 --- a/tests/core/course_resources_list_viewed/existing_course_resources_list_viewed/existing_course_resources_list_viewed_test.php +++ b/tests/core/course_resources_list_viewed/existing_course_resources_list_viewed/existing_course_resources_list_viewed_test.php @@ -29,7 +29,7 @@ * @copyright Milt Reder * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class existing_course_resource_list_viewed extends \logstore_xapi\xapi_test_case { +class existing_course_resources_list_viewed_test extends \logstore_xapi\xapi_test_case { /** * Retrieve the directory of the unit test. From d5edfc2f401a9b3f502bc69c419fc8baf507fd96 Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Tue, 18 Mar 2025 14:12:58 -0400 Subject: [PATCH 09/21] correct textarea test --- .../textarea_anon/{textarea_test.php => textarea_anon_test.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/mod_feedback/response_submitted/textarea_anon/{textarea_test.php => textarea_anon_test.php} (100%) diff --git a/tests/mod_feedback/response_submitted/textarea_anon/textarea_test.php b/tests/mod_feedback/response_submitted/textarea_anon/textarea_anon_test.php similarity index 100% rename from tests/mod_feedback/response_submitted/textarea_anon/textarea_test.php rename to tests/mod_feedback/response_submitted/textarea_anon/textarea_anon_test.php From c0ccfc39069c8143ca39b72a558aab84a0ffc748 Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Thu, 27 Mar 2025 11:20:25 -0400 Subject: [PATCH 10/21] try forcing define --- .../essay_assessed/essay_assessed_test.php | 89 +++++++++++-------- 1 file changed, 51 insertions(+), 38 deletions(-) diff --git a/tests/mod_lesson/essay_assessed/essay_assessed_test.php b/tests/mod_lesson/essay_assessed/essay_assessed_test.php index 9b1ab8531..83cf2954c 100644 --- a/tests/mod_lesson/essay_assessed/essay_assessed_test.php +++ b/tests/mod_lesson/essay_assessed/essay_assessed_test.php @@ -31,47 +31,60 @@ */ class essay_assessed_test extends \logstore_xapi\xapi_test_case { - /** - * Retrieve the directory of the unit test. - * - * @return string - */ - protected function get_test_dir() { - return __DIR__; - } + protected function setUp(): void { + parent::setUp(); - /** - * Retrieve the plugin type being tested. - * - * @return string - */ - protected function get_plugin_type() { - return "mod"; + if (!defined('LESSON_PAGE_SHORTANSWER')) { + define('LESSON_PAGE_SHORTANSWER', 1); + define('LESSON_PAGE_ESSAY', 10); + define('LESSON_PAGE_TRUEFALSE', 2); + define('LESSON_PAGE_MULTICHOICE', 3); + define('LESSON_PAGE_MATCHING', 5); + define('LESSON_PAGE_NUMERICAL', 8); } + } - /** - * Retrieve the plugin name being tested. - * - * @return string - */ - protected function get_plugin_name() { - return "glossary"; - } + /** + * Retrieve the directory of the unit test. + * + * @return string + */ + protected function get_test_dir() { + return __DIR__; + } + + /** + * Retrieve the plugin type being tested. + * + * @return string + */ + protected function get_plugin_type() { + return "mod"; + } + + /** + * Retrieve the plugin name being tested. + * + * @return string + */ + protected function get_plugin_name() { + return "glossary"; + } - /** - * Appease auto-detecting of test cases. xapi_test_case has default test cases. - * - * @covers ::essay_assessed - * @return void - */ - public function test_init() { - if (!defined('LESSON_PAGE_SHORTANSWER')) { - define('LESSON_PAGE_SHORTANSWER', 1); - define('LESSON_PAGE_ESSAY', 10); - define('LESSON_PAGE_TRUEFALSE', 2); - define('LESSON_PAGE_MULTICHOICE', 3); - define('LESSON_PAGE_MATCHING', 5); - define('LESSON_PAGE_NUMERICAL', 8); - } + /** + * Appease auto-detecting of test cases. xapi_test_case has default test cases. + * + * @covers ::essay_assessed + * @return void + */ + public function test_init() { + if (!defined('LESSON_PAGE_SHORTANSWER')) { + define('LESSON_PAGE_SHORTANSWER', 1); + define('LESSON_PAGE_ESSAY', 10); + define('LESSON_PAGE_TRUEFALSE', 2); + define('LESSON_PAGE_MULTICHOICE', 3); + define('LESSON_PAGE_MATCHING', 5); + define('LESSON_PAGE_NUMERICAL', 8); } + } } From 3fa189e7245ba56a2abc67d7f7898a18bd7868e2 Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Fri, 28 Mar 2025 10:43:19 -0400 Subject: [PATCH 11/21] setUp should probably be public --- tests/mod_lesson/essay_assessed/essay_assessed_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/mod_lesson/essay_assessed/essay_assessed_test.php b/tests/mod_lesson/essay_assessed/essay_assessed_test.php index 83cf2954c..9b16222be 100644 --- a/tests/mod_lesson/essay_assessed/essay_assessed_test.php +++ b/tests/mod_lesson/essay_assessed/essay_assessed_test.php @@ -31,7 +31,7 @@ */ class essay_assessed_test extends \logstore_xapi\xapi_test_case { - protected function setUp(): void { + public function setUp(): void { parent::setUp(); if (!defined('LESSON_PAGE_SHORTANSWER')) { From 0cd0a5957969f68d1d202766e3ff51809784990f Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Fri, 28 Mar 2025 10:46:37 -0400 Subject: [PATCH 12/21] attempt to skip mod_survey tests if module is gone --- .../existing_module/existing_module_test.php | 76 +++++++++++-------- .../report_viewed/report_viewed_test.php | 76 +++++++++++-------- .../response_submitted_test.php | 76 +++++++++++-------- 3 files changed, 135 insertions(+), 93 deletions(-) diff --git a/tests/mod_survey/course_module_viewed/existing_module/existing_module_test.php b/tests/mod_survey/course_module_viewed/existing_module/existing_module_test.php index 73184bfa9..11271c17a 100644 --- a/tests/mod_survey/course_module_viewed/existing_module/existing_module_test.php +++ b/tests/mod_survey/course_module_viewed/existing_module/existing_module_test.php @@ -33,40 +33,54 @@ */ class existing_module_test extends \logstore_xapi\xapi_test_case { - /** - * Retrieve the directory of the unit test. - * - * @return string - */ - protected function get_test_dir() { - return __DIR__; - } + /** + * Initialize, skipping if mod_survey is not present. + * + * @return string + */ + public function setUp(): void { + parent::setUp(); - /** - * Retrieve the plugin type being tested. - * - * @return string - */ - protected function get_plugin_type() { - return "mod"; + // Skip tests if mod_survey is not present (i.e., Moodle 5.0+). + if (!is_dir($CFG->dirroot . '/mod/survey')) { + $this->markTestSkipped('mod_survey is not available in Moodle 5.0 and above.'); } + } - /** - * Retrieve the plugin name being tested. - * - * @return string - */ - protected function get_plugin_name() { - return "survey"; - } + /** + * Retrieve the directory of the unit test. + * + * @return string + */ + protected function get_test_dir() { + return __DIR__; + } - /** - * Appease auto-detecting of test cases. xapi_test_case has default test cases. - * - * @covers ::course_module_viewed - * @return void - */ - public function test_init() { + /** + * Retrieve the plugin type being tested. + * + * @return string + */ + protected function get_plugin_type() { + return "mod"; + } - } + /** + * Retrieve the plugin name being tested. + * + * @return string + */ + protected function get_plugin_name() { + return "survey"; + } + + /** + * Appease auto-detecting of test cases. xapi_test_case has default test cases. + * + * @covers ::course_module_viewed + * @return void + */ + public function test_init() { + + } } diff --git a/tests/mod_survey/report_viewed/report_viewed_test.php b/tests/mod_survey/report_viewed/report_viewed_test.php index a4c79c59f..87a489c02 100644 --- a/tests/mod_survey/report_viewed/report_viewed_test.php +++ b/tests/mod_survey/report_viewed/report_viewed_test.php @@ -31,40 +31,54 @@ */ class report_viewed_test extends \logstore_xapi\xapi_test_case { - /** - * Retrieve the directory of the unit test. - * - * @return string - */ - protected function get_test_dir() { - return __DIR__; - } + /** + * Initialize, skipping if mod_survey is not present. + * + * @return string + */ + public function setUp(): void { + parent::setUp(); - /** - * Retrieve the plugin type being tested. - * - * @return string - */ - protected function get_plugin_type() { - return "core"; + // Skip tests if mod_survey is not present (i.e., Moodle 5.0+). + if (!is_dir($CFG->dirroot . '/mod/survey')) { + $this->markTestSkipped('mod_survey is not available in Moodle 5.0 and above.'); } + } - /** - * Retrieve the plugin name being tested. - * - * @return string - */ - protected function get_plugin_name() { - return "mod_survey"; - } + /** + * Retrieve the directory of the unit test. + * + * @return string + */ + protected function get_test_dir() { + return __DIR__; + } - /** - * Appease auto-detecting of test cases. xapi_test_case has default test cases. - * - * @covers ::report_viewed - * @return void - */ - public function test_init() { + /** + * Retrieve the plugin type being tested. + * + * @return string + */ + protected function get_plugin_type() { + return "core"; + } - } + /** + * Retrieve the plugin name being tested. + * + * @return string + */ + protected function get_plugin_name() { + return "mod_survey"; + } + + /** + * Appease auto-detecting of test cases. xapi_test_case has default test cases. + * + * @covers ::report_viewed + * @return void + */ + public function test_init() { + + } } diff --git a/tests/mod_survey/response_submitted/response_submitted_test.php b/tests/mod_survey/response_submitted/response_submitted_test.php index be0f1a9e3..847bc06c0 100644 --- a/tests/mod_survey/response_submitted/response_submitted_test.php +++ b/tests/mod_survey/response_submitted/response_submitted_test.php @@ -31,40 +31,54 @@ */ class response_submitted_test extends \logstore_xapi\xapi_test_case { - /** - * Retrieve the directory of the unit test. - * - * @return string - */ - protected function get_test_dir() { - return __DIR__; - } + /** + * Initialize, skipping if mod_survey is not present. + * + * @return string + */ + public function setUp(): void { + parent::setUp(); - /** - * Retrieve the plugin type being tested. - * - * @return string - */ - protected function get_plugin_type() { - return "core"; + // Skip tests if mod_survey is not present (i.e., Moodle 5.0+). + if (!is_dir($CFG->dirroot . '/mod/survey')) { + $this->markTestSkipped('mod_survey is not available in Moodle 5.0 and above.'); } + } - /** - * Retrieve the plugin name being tested. - * - * @return string - */ - protected function get_plugin_name() { - return "mod_survey"; - } + /** + * Retrieve the directory of the unit test. + * + * @return string + */ + protected function get_test_dir() { + return __DIR__; + } - /** - * Appease auto-detecting of test cases. xapi_test_case has default test cases. - * - * @covers ::response_submitted - * @return void - */ - public function test_init() { + /** + * Retrieve the plugin type being tested. + * + * @return string + */ + protected function get_plugin_type() { + return "core"; + } - } + /** + * Retrieve the plugin name being tested. + * + * @return string + */ + protected function get_plugin_name() { + return "mod_survey"; + } + + /** + * Appease auto-detecting of test cases. xapi_test_case has default test cases. + * + * @covers ::response_submitted + * @return void + */ + public function test_init() { + + } } From 4cf8dec61061c7da4a9e16ff9f8e38f0cf8bdbd5 Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Fri, 28 Mar 2025 10:52:53 -0400 Subject: [PATCH 13/21] add global cfg decl --- .../existing_module/existing_module_test.php | 1 + tests/mod_survey/report_viewed/report_viewed_test.php | 1 + tests/mod_survey/response_submitted/response_submitted_test.php | 1 + 3 files changed, 3 insertions(+) diff --git a/tests/mod_survey/course_module_viewed/existing_module/existing_module_test.php b/tests/mod_survey/course_module_viewed/existing_module/existing_module_test.php index 11271c17a..7692cae10 100644 --- a/tests/mod_survey/course_module_viewed/existing_module/existing_module_test.php +++ b/tests/mod_survey/course_module_viewed/existing_module/existing_module_test.php @@ -39,6 +39,7 @@ class existing_module_test extends \logstore_xapi\xapi_test_case { * @return string */ public function setUp(): void { + global $CFG; parent::setUp(); // Skip tests if mod_survey is not present (i.e., Moodle 5.0+). diff --git a/tests/mod_survey/report_viewed/report_viewed_test.php b/tests/mod_survey/report_viewed/report_viewed_test.php index 87a489c02..63991c639 100644 --- a/tests/mod_survey/report_viewed/report_viewed_test.php +++ b/tests/mod_survey/report_viewed/report_viewed_test.php @@ -37,6 +37,7 @@ class report_viewed_test extends \logstore_xapi\xapi_test_case { * @return string */ public function setUp(): void { + global $CFG; parent::setUp(); // Skip tests if mod_survey is not present (i.e., Moodle 5.0+). diff --git a/tests/mod_survey/response_submitted/response_submitted_test.php b/tests/mod_survey/response_submitted/response_submitted_test.php index 847bc06c0..2c2653ce1 100644 --- a/tests/mod_survey/response_submitted/response_submitted_test.php +++ b/tests/mod_survey/response_submitted/response_submitted_test.php @@ -37,6 +37,7 @@ class response_submitted_test extends \logstore_xapi\xapi_test_case { * @return string */ public function setUp(): void { + global $CFG; parent::setUp(); // Skip tests if mod_survey is not present (i.e., Moodle 5.0+). From d7bdf948bded400378b58973c03d2e7e72a9615e Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Fri, 28 Mar 2025 10:56:01 -0400 Subject: [PATCH 14/21] correct docstrings --- .../existing_module/existing_module_test.php | 2 +- tests/mod_survey/report_viewed/report_viewed_test.php | 2 +- tests/mod_survey/response_submitted/response_submitted_test.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/mod_survey/course_module_viewed/existing_module/existing_module_test.php b/tests/mod_survey/course_module_viewed/existing_module/existing_module_test.php index 7692cae10..87c739099 100644 --- a/tests/mod_survey/course_module_viewed/existing_module/existing_module_test.php +++ b/tests/mod_survey/course_module_viewed/existing_module/existing_module_test.php @@ -36,7 +36,7 @@ class existing_module_test extends \logstore_xapi\xapi_test_case { /** * Initialize, skipping if mod_survey is not present. * - * @return string + * @return void */ public function setUp(): void { global $CFG; diff --git a/tests/mod_survey/report_viewed/report_viewed_test.php b/tests/mod_survey/report_viewed/report_viewed_test.php index 63991c639..26ba0d314 100644 --- a/tests/mod_survey/report_viewed/report_viewed_test.php +++ b/tests/mod_survey/report_viewed/report_viewed_test.php @@ -34,7 +34,7 @@ class report_viewed_test extends \logstore_xapi\xapi_test_case { /** * Initialize, skipping if mod_survey is not present. * - * @return string + * @return void */ public function setUp(): void { global $CFG; diff --git a/tests/mod_survey/response_submitted/response_submitted_test.php b/tests/mod_survey/response_submitted/response_submitted_test.php index 2c2653ce1..ae9ad53c1 100644 --- a/tests/mod_survey/response_submitted/response_submitted_test.php +++ b/tests/mod_survey/response_submitted/response_submitted_test.php @@ -34,7 +34,7 @@ class response_submitted_test extends \logstore_xapi\xapi_test_case { /** * Initialize, skipping if mod_survey is not present. * - * @return string + * @return void */ public function setUp(): void { global $CFG; From 98979fe592521d8960e48e1f7e3abc5eca956b6d Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Fri, 28 Mar 2025 11:07:20 -0400 Subject: [PATCH 15/21] attempt to get around test warning with null coalescing operator --- src/transformer/repos/Repository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transformer/repos/Repository.php b/src/transformer/repos/Repository.php index 1bc0364c5..cf4378a1d 100644 --- a/src/transformer/repos/Repository.php +++ b/src/transformer/repos/Repository.php @@ -49,7 +49,7 @@ abstract public function read_records(string $type, array $query, string $sort = */ public function read_record(string $type, array $query) { $records = $this->read_records($type, $query); - $record = $records[0]; + $record = $records[0] ?? null; // $record = $records[0]; if (!$record) { throw new \Exception("$type not found."); } From 8bc9e94c2d7bd1a4b385d2a184e462be83392e0e Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Fri, 28 Mar 2025 11:11:58 -0400 Subject: [PATCH 16/21] some defensive programming to prevent unhandled record not found error --- src/transformer/repos/Repository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transformer/repos/Repository.php b/src/transformer/repos/Repository.php index cf4378a1d..746aeee56 100644 --- a/src/transformer/repos/Repository.php +++ b/src/transformer/repos/Repository.php @@ -49,7 +49,7 @@ abstract public function read_records(string $type, array $query, string $sort = */ public function read_record(string $type, array $query) { $records = $this->read_records($type, $query); - $record = $records[0] ?? null; // $record = $records[0]; + $record = $records[0] ?? null; if (!$record) { throw new \Exception("$type not found."); } From f61bdd7198b96ecc8a2f519eb86ec6ac352107a3 Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Fri, 28 Mar 2025 11:14:13 -0400 Subject: [PATCH 17/21] skip PHP 8.1 for moodle 5, not compatible --- .github/workflows/moodle-plugin-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/moodle-plugin-ci.yml b/.github/workflows/moodle-plugin-ci.yml index 1ecd4e884..2164248c8 100644 --- a/.github/workflows/moodle-plugin-ci.yml +++ b/.github/workflows/moodle-plugin-ci.yml @@ -42,6 +42,8 @@ jobs: moodle-branch: 'MOODLE_402_STABLE' - php: '8.3' moodle-branch: 'MOODLE_403_STABLE' + - php: '8.1' + moodle-branch: 'main' steps: - name: Check out repository code From 2fc13b071944f1865a046b79a8a9cd099f4c81d3 Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Fri, 28 Mar 2025 11:24:51 -0400 Subject: [PATCH 18/21] try pg 14 --- .github/workflows/moodle-plugin-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moodle-plugin-ci.yml b/.github/workflows/moodle-plugin-ci.yml index 2164248c8..fbc724dfd 100644 --- a/.github/workflows/moodle-plugin-ci.yml +++ b/.github/workflows/moodle-plugin-ci.yml @@ -8,7 +8,7 @@ jobs: services: postgres: - image: postgres:13 + image: postgres:14 env: POSTGRES_USER: 'postgres' POSTGRES_HOST_AUTH_METHOD: 'trust' From b52a8213148a59787c5080c1183cfafc46d82fc2 Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Fri, 28 Mar 2025 11:30:07 -0400 Subject: [PATCH 19/21] add TODO about replacing main branch --- .github/workflows/moodle-plugin-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/moodle-plugin-ci.yml b/.github/workflows/moodle-plugin-ci.yml index fbc724dfd..449051e6c 100644 --- a/.github/workflows/moodle-plugin-ci.yml +++ b/.github/workflows/moodle-plugin-ci.yml @@ -31,6 +31,7 @@ jobs: fail-fast: false matrix: php: ['8.1', '8.2', '8.3'] + # TODO: replace 'main' with 5.0 branch when available moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE', 'MOODLE_405_STABLE', 'main'] database: [pgsql, mariadb] exclude: From 8c10502420e56a2395126e2054588140dfd1186e Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Mon, 28 Apr 2025 10:43:48 -0400 Subject: [PATCH 20/21] use official MOODLE_500_STABLE branch --- .github/workflows/moodle-plugin-ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/moodle-plugin-ci.yml b/.github/workflows/moodle-plugin-ci.yml index 449051e6c..a02ff1938 100644 --- a/.github/workflows/moodle-plugin-ci.yml +++ b/.github/workflows/moodle-plugin-ci.yml @@ -31,8 +31,7 @@ jobs: fail-fast: false matrix: php: ['8.1', '8.2', '8.3'] - # TODO: replace 'main' with 5.0 branch when available - moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE', 'MOODLE_405_STABLE', 'main'] + moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE', 'MOODLE_405_STABLE', 'MOODLE_500_STABLE'] database: [pgsql, mariadb] exclude: - php: '8.2' @@ -44,7 +43,7 @@ jobs: - php: '8.3' moodle-branch: 'MOODLE_403_STABLE' - php: '8.1' - moodle-branch: 'main' + moodle-branch: 'MOODLE_500_STABLE' steps: - name: Check out repository code From cd0ae77566b53748449410e123639afee0592973 Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Mon, 28 Apr 2025 11:12:02 -0400 Subject: [PATCH 21/21] try release of moodle-plugin-ci again --- .github/workflows/moodle-plugin-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moodle-plugin-ci.yml b/.github/workflows/moodle-plugin-ci.yml index a02ff1938..7d67179eb 100644 --- a/.github/workflows/moodle-plugin-ci.yml +++ b/.github/workflows/moodle-plugin-ci.yml @@ -63,7 +63,7 @@ jobs: - name: Initialise moodle-plugin-ci run: | - composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci dev-main + composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4 echo $(cd ci/bin; pwd) >> $GITHUB_PATH echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH sudo locale-gen en_AU.UTF-8