Repository navigation
Set the page course module in the overridden feedback tests - #167
Merged
adrian-sarmas merged 1 commit intoOct 26, 2026
Conversation
…dden grade in tests Editor plugins may build the settings navigation while the editor is rendered. With only the module context set, the navigation looks up the course module and fails because the page course is still the site. Setting the course module and course of the page fixes this, and the output buffer is now closed even if rendering fails. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
adrian-sarmas
merged commit Oct 26, 2026
3fd8627
into
elearningsoftware:master
38 of 54 checks passed
Collaborator
|
Thanks for the fix, merged! It still failed on MariaDB for Moodle 4.4+ with "The theme has already been set up for this page". Since 4.4, create_and_enrol() sends a course welcome message, and email_to_user() sets up the page theme while the page course is still the site. After that, set_cm() can't change the course. I couldn't push to your branch, so I added a follow-up commit (81ff763) that sets up the page before the users are enrolled. Your set_cm() and try/finally changes are unchanged, and CI is green on all versions now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey! The overridden feedback tests in
lib_test.phpblow up with "The course you passed to $PAGE->set_cm does not correspond to the $cm" as soon as a TinyMCE plugin builds the navigation while the editor renders (e.g. tiny_stash), because only the module context was set and the page course was still the site. This sets the course module and course on$PAGEand closes the output buffer in afinally, so the tests are green again and don't leave a dangling buffer. Cheers!