diff --git a/completion/tests/api_test.php b/completion/tests/api_test.php index 67624842086..489d0d03694 100644 --- a/completion/tests/api_test.php +++ b/completion/tests/api_test.php @@ -56,7 +56,7 @@ class core_completion_api_testcase extends advanced_testcase { // Create the completion event. $CFG->enablecompletion = true; - \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, $time); + \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, $time); // Check that there is now an event in the database. $events = $DB->get_records('event'); @@ -88,10 +88,10 @@ class core_completion_api_testcase extends advanced_testcase { // Create the event. $CFG->enablecompletion = true; - \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, $time); + \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, $time); // Call it again, but this time with a different time. - \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, $time + DAYSECS); + \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, $time + DAYSECS); // Check that there is still only one event in the database. $events = $DB->get_records('event'); @@ -123,10 +123,10 @@ class core_completion_api_testcase extends advanced_testcase { // Create the event. $CFG->enablecompletion = true; - \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, $time); + \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, $time); // Call it again, but the time specified as null. - \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, null); + \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, null); // Check that there is no event in the database. $this->assertEquals(0, $DB->count_records('event')); @@ -146,7 +146,7 @@ class core_completion_api_testcase extends advanced_testcase { // Try and create the completion event with completion disabled. $CFG->enablecompletion = false; - \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, $time); + \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, $time); // Check that there is no event in the database. $this->assertEquals(0, $DB->count_records('event')); @@ -166,13 +166,13 @@ class core_completion_api_testcase extends advanced_testcase { // Create the completion event. $CFG->enablecompletion = true; - \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, $time); + \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, $time); // Disable completion. $CFG->enablecompletion = false; // Try and update the completion date. - \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, $time + DAYSECS); + \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, $time + DAYSECS); // Check that there is an event in the database. $events = $DB->get_records('event'); @@ -204,13 +204,13 @@ class core_completion_api_testcase extends advanced_testcase { // Create the completion event. $CFG->enablecompletion = true; - \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, $time); + \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, $time); // Disable completion. $CFG->enablecompletion = false; // Should still be able to delete completion events even when completion is disabled. - \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, null); + \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, null); // Check that there is now no event in the database. $this->assertEquals(0, $DB->count_records('event')); diff --git a/course/tests/courselib_test.php b/course/tests/courselib_test.php index 5ce1ffab17d..5da897db9a3 100644 --- a/course/tests/courselib_test.php +++ b/course/tests/courselib_test.php @@ -3237,6 +3237,8 @@ class core_course_courselib_testcase extends advanced_testcase { $this->resetAfterTest(true); + $this->setAdminUser(); + $CFG->enablecompletion = true; $this->setTimezone('UTC'); diff --git a/lib/testing/tests/generator_test.php b/lib/testing/tests/generator_test.php index 2d3e7e970f2..33bdd99dfa1 100644 --- a/lib/testing/tests/generator_test.php +++ b/lib/testing/tests/generator_test.php @@ -186,6 +186,9 @@ class core_test_generator_testcase extends advanced_testcase { public function test_create_module() { global $CFG, $SITE, $DB; + + $this->setAdminUser(); + if (!file_exists("$CFG->dirroot/mod/page/")) { $this->markTestSkipped('Can not find standard Page module'); }