Issue #28: Fixed PHPUnit test issues#30
Merged
Merged
Conversation
Contributor
|
This looks good N. Just one small comment. CI is failing on version bump. I think it would be best practice to follow the CI's comment. |
e46cde6 to
af255f8
Compare
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.
Closes issue #28.
Added
?to nullable function parameter forget_diagnosis_data()to resolve PHPUnit test deprecation warning.Added try/catch around course competency API call.
Why does this fails in 5.1, but not 4.5? In Moodle 4.5, the API call to
hook_course_module_deleted()simply deletes the course module competency record.Code in 4.5:
In 5.1, the
hook_course_module_deleted()function also deletes the context from thecompetency_evidencetable:During the test, the CM context does not exist in the
competency_evidencetable, causing the unit test to fail with adml_missing_record_exception. We avoid the test failure by adding a try/catch block around the API call. If the record does not exist in thecompetency_evidencetable, then there is no data to be removed, and the execution will continue.Environment
Testing instructions:
tool_fix_delete_modulestest suite:vendor/bin/phpunit --testsuite tool_fix_delete_modules_testsuitetool_fix_delete_moduleswill produce the following errors (on the above environment):Expected Output from PHPUnit Tests
MOODLE_35_STABLE-issue28and re-running the testsuite: