Skip to content

Commit

Permalink
CTP-3783 phpunit build fails
Browse files Browse the repository at this point in the history
  • Loading branch information
watson8 committed Oct 28, 2024
1 parent 48bd4fe commit b8a9f84
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ function coursework_get_coursework_ids_from_context_id($contextid) {
$coursemodule = get_coursemodule_from_id('coursework', $context->instanceid);
$courseworkmoduleid = $DB->get_field('modules', 'id', ['name' => 'coursework']);

if ($coursemodule->module == $courseworkmoduleid) {
if ($coursemodule && $coursemodule->module == $courseworkmoduleid) {
$courseworkids[] = $coursemodule->instance;
}
break;
Expand Down
4 changes: 4 additions & 0 deletions tests/generator_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ final class generator_test extends \advanced_testcase {
*/
public function setUp(): void {
$this->resetAfterTest(true);
// If we don't do this, we end up with the same cached objects for all tests and they may have incorrect/missing properties.
\mod_coursework\models\coursework::$pool = null;
\mod_coursework\models\course_module::$pool = null;
\mod_coursework\models\module::$pool = null;
}

/**
Expand Down

0 comments on commit b8a9f84

Please sign in to comment.