This commit is contained in:
Andrew Nicols 2020-08-13 11:50:09 +08:00
commit e0f91914a7
2 changed files with 6 additions and 2 deletions

View File

@ -84,7 +84,7 @@ function quiz_add_instance($quiz) {
$cmid = $quiz->coursemodule;
// Process the options from the form.
$quiz->created = time();
$quiz->timecreated = time();
$result = quiz_process_options($quiz);
if ($result && is_string($result)) {
return $result;

View File

@ -49,7 +49,8 @@ class mod_quiz_generator_testcase extends advanced_testcase {
$generator->create_instance(array('course'=>$SITE->id));
$generator->create_instance(array('course'=>$SITE->id));
$quiz = $generator->create_instance(array('course'=>$SITE->id));
$createtime = time();
$quiz = $generator->create_instance(array('course' => $SITE->id, 'timecreated' => 0));
$this->assertEquals(3, $DB->count_records('quiz'));
$cm = get_coursemodule_from_instance('quiz', $quiz->id);
@ -59,5 +60,8 @@ class mod_quiz_generator_testcase extends advanced_testcase {
$context = context_module::instance($cm->id);
$this->assertEquals($quiz->cmid, $context->instanceid);
$this->assertEqualsWithDelta($createtime,
$DB->get_field('quiz', 'timecreated', ['id' => $cm->instance]), 2);
}
}