MDL-41039 mod_quiz: Renaming event to attempt_becameoverdue

This commit is contained in:
Frederic Massart 2013-09-18 12:03:48 +08:00
parent d900f1dc05
commit 0a8b091d41
4 changed files with 9 additions and 6 deletions

View file

@ -1459,7 +1459,7 @@ class quiz_attempt {
$this->attempt->timecheckstate = $timestamp; $this->attempt->timecheckstate = $timestamp;
$DB->update_record('quiz_attempts', $this->attempt); $DB->update_record('quiz_attempts', $this->attempt);
$this->fire_state_transition_event('\mod_quiz\event\attempt_timelimit_exceeded', $timestamp); $this->fire_state_transition_event('\mod_quiz\event\attempt_becameoverdue', $timestamp);
$transaction->allow_commit(); $transaction->allow_commit();
} }

View file

@ -27,11 +27,14 @@ defined('MOODLE_INTERNAL') || die();
/** /**
* Event for when a quiz attempt is overdue. * Event for when a quiz attempt is overdue.
* *
* Please note that the name of this event is not following the event naming convention.
* Its name should not be used as a reference for other events to be created.
*
* @package mod_quiz * @package mod_quiz
* @copyright 2013 Adrian Greeve <adrian@moodle.com> * @copyright 2013 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
class attempt_timelimit_exceeded extends \core\event\base { class attempt_becameoverdue extends \core\event\base {
/** /**
* Init method. * Init method.

View file

@ -50,10 +50,10 @@ $observers = array(
'callback' => '\mod_quiz\group_observers::group_member_removed', 'callback' => '\mod_quiz\group_observers::group_member_removed',
), ),
// Handle our own \mod_quiz\event\attempt_timelimit_exceeded event, to email // Handle our own \mod_quiz\event\attempt_becameoverdue event, to email
// the student to let them know they forgot to submit, and that they have another chance. // the student to let them know they forgot to submit, and that they have another chance.
array( array(
'eventname' => '\mod_quiz\event\attempt_timelimit_exceeded', 'eventname' => '\mod_quiz\event\attempt_becameoverdue',
'includefile' => '/mod/quiz/locallib.php', 'includefile' => '/mod/quiz/locallib.php',
'callback' => 'quiz_attempt_overdue_handler', 'callback' => 'quiz_attempt_overdue_handler',
'internal' => false, 'internal' => false,

View file

@ -119,7 +119,7 @@ class mod_quiz_events_testcase extends advanced_testcase {
$this->assertEventLegacyData($legacydata, $event); $this->assertEventLegacyData($legacydata, $event);
} }
public function test_attempt_timelimit_exceeded() { public function test_attempt_becameoverdue() {
list($quizobj, $quba, $attempt) = $this->prepare_quiz_data(); list($quizobj, $quba, $attempt) = $this->prepare_quiz_data();
$attemptobj = quiz_attempt::create($attempt->id); $attemptobj = quiz_attempt::create($attempt->id);
@ -133,7 +133,7 @@ class mod_quiz_events_testcase extends advanced_testcase {
$this->assertCount(1, $events); $this->assertCount(1, $events);
$event = $events[0]; $event = $events[0];
$this->assertInstanceOf('\mod_quiz\event\attempt_timelimit_exceeded', $event); $this->assertInstanceOf('\mod_quiz\event\attempt_becameoverdue', $event);
$this->assertEquals('quiz_attempts', $event->objecttable); $this->assertEquals('quiz_attempts', $event->objecttable);
$this->assertEquals($quizobj->get_context(), $event->get_context()); $this->assertEquals($quizobj->get_context(), $event->get_context());
$this->assertEquals($attempt->userid, $event->relateduserid); $this->assertEquals($attempt->userid, $event->relateduserid);