mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
Merge branch 'MDL-62715-master' of git://github.com/andrewnicols/moodle
This commit is contained in:
commit
25a592ff5f
@ -119,12 +119,20 @@ trait mod_assign_test_generator {
|
||||
* @param bool $changeuser Whether to switch user to the user being submitted as.
|
||||
*/
|
||||
protected function mark_submission($teacher, $assign, $student, $grade = 50.0, $data = [], $attempt = 0) {
|
||||
global $DB;
|
||||
|
||||
// Mark the submission.
|
||||
$this->setUser($teacher);
|
||||
$data = (object) array_merge($data, [
|
||||
'grade' => $grade,
|
||||
]);
|
||||
|
||||
// Bump all timecreated and timemodified for this user back.
|
||||
// The old assign_print_overview function includes submissions which have been graded where the grade modified
|
||||
// date matches the submission modified date.
|
||||
$DB->execute('UPDATE {assign_submission} SET timecreated = timecreated - 1, timemodified = timemodified - 1 WHERE userid = :userid',
|
||||
['userid' => $student->id]);
|
||||
|
||||
$assign->testable_apply_grade_to_user($data, $student->id, $attempt);
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ class mod_assign_lib_testcase extends advanced_testcase {
|
||||
$this->assertEquals(1, count($overview));
|
||||
// Submissions without a grade.
|
||||
$this->assertRegExp('/.*Open Assignment.*/', $overview[$course->id]['assign']);
|
||||
$this->assertRegExp('/.*Assignment with submissions.*/', $overview[$course->id]['assign']);
|
||||
$this->assertNotRegExp('/.*Assignment with submissions.*/', $overview[$course->id]['assign']);
|
||||
|
||||
$this->setUser($teacher);
|
||||
$overview = array();
|
||||
@ -129,7 +129,7 @@ class mod_assign_lib_testcase extends advanced_testcase {
|
||||
$this->assertEquals(1, count($overview));
|
||||
// Submissions without a grade.
|
||||
$this->assertRegExp('/.*Open Assignment.*/', $overview[$course->id]['assign']);
|
||||
$this->assertRegExp('/.*Assignment with submissions.*/', $overview[$course->id]['assign']);
|
||||
$this->assertNotRegExp('/.*Assignment with submissions.*/', $overview[$course->id]['assign']);
|
||||
|
||||
// Let us grade a submission.
|
||||
$this->setUser($teacher);
|
||||
@ -145,20 +145,16 @@ class mod_assign_lib_testcase extends advanced_testcase {
|
||||
|
||||
$overview = array();
|
||||
assign_print_overview($courses, $overview);
|
||||
$this->assertDebuggingCalledCount(3);
|
||||
$this->assertEquals(1, count($overview));
|
||||
// Now assignment 4 should not show up.
|
||||
$this->assertNotRegExp('/.*Open Assignment.*/', $overview[$course->id]['assign']);
|
||||
$this->assertRegExp('/.*Assignment with submissions.*/', $overview[$course->id]['assign']);
|
||||
$this->assertDebuggingCalledCount(3);
|
||||
$this->assertEmpty($overview);
|
||||
|
||||
$this->setUser($teacher);
|
||||
$overview = array();
|
||||
assign_print_overview($courses, $overview);
|
||||
$this->assertDebuggingCalledCount(3);
|
||||
$this->assertEquals(1, count($overview));
|
||||
// Now assignment 4 should not show up.
|
||||
$this->assertNotRegExp('/.*Open Assignment.*/', $overview[$course->id]['assign']);
|
||||
$this->assertRegExp('/.*Assignment with submissions.*/', $overview[$course->id]['assign']);
|
||||
$this->assertEmpty($overview);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1065,10 +1065,6 @@ class mod_assign_locallib_testcase extends advanced_testcase {
|
||||
$this->add_submission($student, $assign);
|
||||
$this->submit_for_grading($student, $assign);
|
||||
|
||||
// TODO Find a way to kill this waitForSecond
|
||||
// This is to make sure the grade happens after the submission because
|
||||
// we have no control over the timemodified values.
|
||||
$this->waitForSecond();
|
||||
$this->mark_submission($teacher, $assign, $student, 50.0);
|
||||
|
||||
$data = new stdClass();
|
||||
@ -1336,7 +1332,6 @@ class mod_assign_locallib_testcase extends advanced_testcase {
|
||||
|
||||
$this->add_submission($student, $assign);
|
||||
$this->submit_for_grading($student, $assign);
|
||||
$this->waitForSecond();
|
||||
$this->mark_submission($teacher, $assign, $student, 50.0);
|
||||
|
||||
// Although it has been graded, it is still marked as submitted.
|
||||
|
Loading…
x
Reference in New Issue
Block a user