MDL-45062 webservices: fix unit test for update_grades

This fixes the broken unit test (which exposes a fail) and
the next patch from Juan fixes the fail.
This commit is contained in:
Damyon Wiese 2014-04-16 10:55:58 +08:00
parent 0cbd1f913d
commit 63c61733f0

View File

@ -284,6 +284,7 @@ class core_grades_external_testcase extends externallib_advanced_testcase {
array(),
array('hidden' => 1)
);
$result = external_api::clean_returnvalue(core_grades_external::update_grades_returns(), $result);
$this->assertTrue($result == GRADE_UPDATE_OK);
// Check it's definitely hidden.
@ -409,6 +410,7 @@ class core_grades_external_testcase extends externallib_advanced_testcase {
array(),
array('grademax' => $changedmax)
);
$result = external_api::clean_returnvalue(core_grades_external::update_grades_returns(), $result);
$this->assertTrue($result == GRADE_UPDATE_OK);
$grades = grade_get_grades($course->id, 'mod', 'assign', $assignment->id);
$this->assertTrue($grades->items[0]->grademax == $changedmax);
@ -423,6 +425,7 @@ class core_grades_external_testcase extends externallib_advanced_testcase {
0,
array(array('studentid' => $student1->id, 'grade' => $student1grade))
);
$result = external_api::clean_returnvalue(core_grades_external::update_grades_returns(), $result);
$this->assertTrue($result == GRADE_UPDATE_OK);
$grades = grade_get_grades($course->id, 'mod', 'assign', $assignment->id, array($student1->id));
$this->assertTrue($grades->items[0]->grades[$student1->id]->grade == $student1grade);
@ -441,6 +444,7 @@ class core_grades_external_testcase extends externallib_advanced_testcase {
array('studentid' => $student2->id, 'grade' => $student2grade)
)
);
$result = external_api::clean_returnvalue(core_grades_external::update_grades_returns(), $result);
$this->assertTrue($result == GRADE_UPDATE_OK);
$grades = grade_get_grades($course->id, 'mod', 'assign', $assignment->id, array($student1->id, $student2->id));
$this->assertTrue($grades->items[0]->grades[$student1->id]->grade == $student1grade);
@ -516,6 +520,7 @@ class core_grades_external_testcase extends externallib_advanced_testcase {
array(),
array('hidden' => 1)
);
$result = external_api::clean_returnvalue(core_grades_external::update_grades_returns(), $result);
$this->assertTrue($result == GRADE_UPDATE_OK);
$grades = grade_get_grades($course->id, 'mod', 'assign', $assignment->id);
$this->assertTrue($grades->items[0]->hidden == 1);