MDL-42350 assign: Test group submission + drafts

This commit is contained in:
Damyon Wiese 2013-11-04 13:41:51 +08:00 committed by Sam Hemelryk
parent 7a47babb9e
commit 2bd27878db

View File

@ -669,6 +669,52 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
$this->assertEquals(null, $gradinginfo->items[0]->grades[$this->extrastudents[0]->id]->datesubmitted);
}
public function test_group_submissions_submit_for_marking() {
global $PAGE;
$this->create_extra_users();
// Now verify group assignments.
$this->setUser($this->editingteachers[0]);
$assign = $this->create_instance(array('teamsubmission'=>1,
'assignsubmission_onlinetext_enabled'=>1,
'submissiondrafts'=>1,
'requireallteammemberssubmit'=>1));
$PAGE->set_url(new moodle_url('/mod/assign/view.php', array('id' => $assign->get_course_module()->id)));
$this->setUser($this->extrastudents[0]);
// Add a submission.
$data = new stdClass();
$data->onlinetext_editor = array('itemid'=>file_get_unused_draft_itemid(),
'text'=>'Submission text',
'format'=>FORMAT_MOODLE);
$notices = array();
$assign->save_submission($data, $notices);
// Check we can see the submit button.
$output = $assign->view_student_summary($this->extrastudents[0], true);
$this->assertContains(get_string('submitassignment', 'assign'), $output);
$submission = $assign->get_group_submission($this->extrastudents[0]->id, 0, true);
$submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
$assign->testable_update_submission($submission, $this->extrastudents[0]->id, true, true);
// Check that the student does not see "Submit" button.
$output = $assign->view_student_summary($this->extrastudents[0], true);
$this->assertNotContains(get_string('submitassignment', 'assign'), $output);
// Change to another user in the same group.
$this->setUser($this->extrastudents[self::GROUP_COUNT]);
$output = $assign->view_student_summary($this->extrastudents[self::GROUP_COUNT], true);
$this->assertContains(get_string('submitassignment', 'assign'), $output);
$submission = $assign->get_group_submission($this->extrastudents[self::GROUP_COUNT]->id, 0, true);
$submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
$assign->testable_update_submission($submission, $this->extrastudents[self::GROUP_COUNT]->id, true, true);
$output = $assign->view_student_summary($this->extrastudents[self::GROUP_COUNT], true);
$this->assertNotContains(get_string('submitassignment', 'assign'), $output);
}
public function test_submissions_open() {
$this->setUser($this->editingteachers[0]);