From a59126a4189638b78e664b12fed7e09a3eb0f2d1 Mon Sep 17 00:00:00 2001 From: Stephan Robotta Date: Fri, 18 Oct 2024 23:17:23 +0200 Subject: [PATCH] Fix issue with Moodle 4.1 that user add page is not displayed. --- classes/plugininfo.php | 7 +++++++ tests/behat/user.feature | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/behat/user.feature diff --git a/classes/plugininfo.php b/classes/plugininfo.php index 92a2c78..3cc6987 100644 --- a/classes/plugininfo.php +++ b/classes/plugininfo.php @@ -89,6 +89,13 @@ public static function get_plugin_configuration_for_context( 'testsite' => false, 'multianswerrgx' => false, ]; + + // In Moodle 4.1 in /user/editadvanced.php the class question_bank is not found. So + // multianswerrgx is not supported with 4.1. + if (moodle_major_version() < 4.2) { + return $config; + } + try { // Check if the multianswerrgx question type is available. $instance = question_bank::get_qtype('multianswerrgx'); diff --git a/tests/behat/user.feature b/tests/behat/user.feature new file mode 100644 index 0000000..22ab4db --- /dev/null +++ b/tests/behat/user.feature @@ -0,0 +1,17 @@ +@editor @tiny @editor_tiny @tiny_cloze @javascript +Feature: Check that the user edit page appears and no exception is thrown. + + Background: + Given the following "courses" exist: + | fullname | shortname | + | Course fullname | C_shortname | + And the following "user preferences" exist: + | user | preference | value | + | admin | htmleditor | tiny | + And I log in as "admin" + + @javascript + Scenario: Open the page to add a user + When I navigate to "Users > Add a new user" in site administration + Then I should see "First name" + And I click on the "Image" button for the "Description" TinyMCE editor