MDL-47706 gradebook: Update pageload time between changes

Since MDL-38732 we reject changes if another change has been made more
recently. As a result, if process_data is called, and then we roll into the
next millisecond period before process_data is called again, the change is
rejected.

Different errors were seen because the millisecond rollover occurred at
different time within the test.

Different error conditions were seen because not all of the tests check for
an error from the call to process_data(), instead just checking that the
value had been updated correctly.
This commit is contained in:
Andrew Nicols
2014-10-22 12:56:07 +08:00
parent 7a61e645c3
commit bedcf338dc
+3
View File
@@ -80,6 +80,7 @@ class core_grade_report_graderlib_testcase extends advanced_testcase {
// Grade above max. Should be pulled down to max.
$toobig = 200.00;
$data->grade[$student->id][$forum1->id] = $toobig;
$data->timepageload = time();
$warnings = $report->process_data($data);
$this->assertEquals(count($warnings), 1);
@@ -89,6 +90,7 @@ class core_grade_report_graderlib_testcase extends advanced_testcase {
// Grade below min. Should be pulled up to min.
$toosmall = -10.00;
$data->grade[$student->id][$forum1->id] = $toosmall;
$data->timepageload = time();
$warnings = $report->process_data($data);
$this->assertEquals(count($warnings), 1);
@@ -99,6 +101,7 @@ class core_grade_report_graderlib_testcase extends advanced_testcase {
$CFG->unlimitedgrades = 1;
$data->grade[$student->id][$forum1->id] = $toobig;
$data->timepageload = time();
$warnings = $report->process_data($data);
$this->assertEquals(count($warnings), 0);