MDL-75719 completion: Fix unit tests and Behat tests.

Fix tests since we changed behavior of completions (completion
state an UI).
This commit is contained in:
Ilya Tregubov
2023-03-02 11:04:08 +08:00
parent 3ebd25ff48
commit 23915a35ae
2 changed files with 36 additions and 5 deletions
+24
View File
@@ -1319,6 +1319,30 @@ class completionlib_test extends advanced_testcase {
$this->assertEquals(
COMPLETION_COMPLETE,
completion_info::internal_get_grade_state($item, $grade));
// Item is hidden, but returnpassfail is true and the grade is passing.
$item->hidden = 1;
$item->gradepass = 4;
$grade->finalgrade = 5.0;
$this->assertEquals(
COMPLETION_COMPLETE_PASS,
completion_info::internal_get_grade_state($item, $grade, true));
// Item is hidden, but returnpassfail is true and the grade is failing.
$item->hidden = 1;
$item->gradepass = 4;
$grade->finalgrade = 3.0;
$this->assertEquals(
COMPLETION_COMPLETE_FAIL_HIDDEN,
completion_info::internal_get_grade_state($item, $grade, true));
// Item is not hidden, but returnpassfail is true and the grade is failing.
$item->hidden = 0;
$item->gradepass = 4;
$grade->finalgrade = 3.0;
$this->assertEquals(
COMPLETION_COMPLETE_FAIL,
completion_info::internal_get_grade_state($item, $grade, true));
}
/**