Skip to content

Fix section checking#137

Merged
PhMemmel merged 1 commit intoSyxton:masterfrom
catalyst:issue135_master
Jul 17, 2025
Merged

Fix section checking#137
PhMemmel merged 1 commit intoSyxton:masterfrom
catalyst:issue135_master

Conversation

@tuanngocnguyen
Copy link

Fix for

#135

@PhMemmel
Copy link
Collaborator

Thank you for raising the issue and providing a fix. I think we reached a point where all of this, especially dealing with the restriction hooks require to be covered by detailed unit tests, especially covering the cases with and without present hooks. Would you mind adding some?

@tuanngocnguyen
Copy link
Author

tuanngocnguyen commented Jul 15, 2025

Hi @PhMemmel,

Thanks for your comment, I have added unit test for filter_sections_different_course hook. The test without hood should already covered in test_mass_duplicate_modules_to_course.

@tuanngocnguyen
Copy link
Author

Hi @PhMemmel ,

The patch has been tested on my local dev, would you please review once you have time?
Thanks

Copy link
Collaborator

@PhMemmel PhMemmel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your work.

  • The changes make sense to me
  • Code is well documented
  • I also tested manually and could not find a regression
  • Coverage is good, thank you for adding the test

Just one minor annotation: If I'm not overlooking anything you could make the tests a bit less complicated/more readable by using $this->redirectHook(...) in the unit test method. By using this you do not need to create and inckude any fixture files but instead just define the hook callback function as private function in the test class or even anonymous callback function directly in the test method itself. This at least has shown very helpful to me when I wrote unit tests for hooks.

@PhMemmel
Copy link
Collaborator

Could you also please rebase your branch to the latest master? I merged the updated GHA workflow config so pipelines are green (at least for Moodle 5).

@tuanngocnguyen
Copy link
Author

Hi @PhMemmel ,

Thanks for your review and suggestion.

I have updated the patch with redirectHook, and removed fixtures.
I have also rebased my branch.

Copy link
Collaborator

@PhMemmel PhMemmel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your contribution!

@PhMemmel
Copy link
Collaborator

for documentation purposes: failing main branch GHA not related to this PR

@PhMemmel PhMemmel merged commit 959756a into Syxton:master Jul 17, 2025
4 of 8 checks passed
@tuanngocnguyen
Copy link
Author

Thanks @PhMemmel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants