From 2ceee45b769f6b29cca59f4527ec68c08e2dfcab Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Fri, 20 Feb 2015 15:21:54 +0000 Subject: [PATCH] MDL-49075 mod_assign: Add assertions to marking workflow unit test Make sure grades aren't pushed to gradebook for marking workflow states other than 'released'. --- mod/assign/tests/locallib_test.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/mod/assign/tests/locallib_test.php b/mod/assign/tests/locallib_test.php index 3d38f0b784a..4e912731be7 100644 --- a/mod/assign/tests/locallib_test.php +++ b/mod/assign/tests/locallib_test.php @@ -1618,6 +1618,10 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase { $output = $assign->view_student_summary($this->students[0], true); $this->assertEquals(false, strpos($output, '50.0')); + // Make sure the grade isn't pushed to the gradebook. + $grades = $assign->get_user_grades_for_gradebook($this->students[0]->id); + $this->assertEmpty($grades); + // Mark the submission and set to inmarking. $this->setUser($this->teachers[0]); $data = new stdClass(); @@ -1630,6 +1634,10 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase { $output = $assign->view_student_summary($this->students[0], true); $this->assertEquals(false, strpos($output, '50.0')); + // Make sure the grade isn't pushed to the gradebook. + $grades = $assign->get_user_grades_for_gradebook($this->students[0]->id); + $this->assertEmpty($grades); + // Mark the submission and set to readyforreview. $this->setUser($this->teachers[0]); $data = new stdClass(); @@ -1642,6 +1650,10 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase { $output = $assign->view_student_summary($this->students[0], true); $this->assertEquals(false, strpos($output, '50.0')); + // Make sure the grade isn't pushed to the gradebook. + $grades = $assign->get_user_grades_for_gradebook($this->students[0]->id); + $this->assertEmpty($grades); + // Mark the submission and set to inreview. $this->setUser($this->teachers[0]); $data = new stdClass(); @@ -1654,6 +1666,10 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase { $output = $assign->view_student_summary($this->students[0], true); $this->assertEquals(false, strpos($output, '50.0')); + // Make sure the grade isn't pushed to the gradebook. + $grades = $assign->get_user_grades_for_gradebook($this->students[0]->id); + $this->assertEmpty($grades); + // Mark the submission and set to readyforrelease. $this->setUser($this->teachers[0]); $data = new stdClass(); @@ -1666,6 +1682,10 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase { $output = $assign->view_student_summary($this->students[0], true); $this->assertEquals(false, strpos($output, '50.0')); + // Make sure the grade isn't pushed to the gradebook. + $grades = $assign->get_user_grades_for_gradebook($this->students[0]->id); + $this->assertEmpty($grades); + // Mark the submission and set to released. $this->setUser($this->teachers[0]); $data = new stdClass(); @@ -1677,6 +1697,10 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase { $this->setUser($this->students[0]); $output = $assign->view_student_summary($this->students[0], true); $this->assertNotEquals(false, strpos($output, '50.0')); + + // Make sure the grade is pushed to the gradebook. + $grades = $assign->get_user_grades_for_gradebook($this->students[0]->id); + $this->assertEquals(50, (int)$grades[$this->students[0]->id]->rawgrade); } public function test_markerallocation() {