| Línea 45... |
Línea 45... |
| 45 |
parent::setUp();
|
45 |
parent::setUp();
|
| 46 |
$this->renderer = $PAGE->get_renderer('qbehaviour_adaptive');
|
46 |
$this->renderer = $PAGE->get_renderer('qbehaviour_adaptive');
|
| 47 |
$this->options = new question_display_options();
|
47 |
$this->options = new question_display_options();
|
| 48 |
}
|
48 |
}
|
| Línea 49... |
Línea 49... |
| 49 |
|
49 |
|
| 50 |
public function test_blank_before_graded() {
|
50 |
public function test_blank_before_graded(): void {
|
| 51 |
$this->assertEquals('',
|
51 |
$this->assertEquals('',
|
| 52 |
$this->renderer->render_adaptive_marks(new qbehaviour_adaptive_mark_details(
|
52 |
$this->renderer->render_adaptive_marks(new qbehaviour_adaptive_mark_details(
|
| 53 |
question_state::$todo), $this->options));
|
53 |
question_state::$todo), $this->options));
|
| Línea 54... |
Línea 54... |
| 54 |
}
|
54 |
}
|
| 55 |
|
55 |
|
| 56 |
public function test_correct_no_penalty() {
|
56 |
public function test_correct_no_penalty(): void {
|
| 57 |
$this->assertEquals('<div class="correctness badge correct">' . get_string('correct', 'question') . '</div>' .
|
57 |
$this->assertEquals('<div class="correctness badge correct">' . get_string('correct', 'question') . '</div>' .
|
| 58 |
'<div class="gradingdetails">' .
|
58 |
'<div class="gradingdetails">' .
|
| 59 |
get_string('gradingdetails', 'qbehaviour_adaptive',
|
59 |
get_string('gradingdetails', 'qbehaviour_adaptive',
|
| 60 |
array('cur' => '1.00', 'raw' => '1.00', 'max' => '1.00')) . '</div>',
|
60 |
array('cur' => '1.00', 'raw' => '1.00', 'max' => '1.00')) . '</div>',
|
| 61 |
$this->renderer->render_adaptive_marks(new qbehaviour_adaptive_mark_details(
|
61 |
$this->renderer->render_adaptive_marks(new qbehaviour_adaptive_mark_details(
|
| Línea 62... |
Línea 62... |
| 62 |
question_state::$gradedright, 1, 1, 1, 0, 0, false), $this->options));
|
62 |
question_state::$gradedright, 1, 1, 1, 0, 0, false), $this->options));
|
| 63 |
}
|
63 |
}
|
| 64 |
|
64 |
|
| 65 |
public function test_partial_first_try() {
|
65 |
public function test_partial_first_try(): void {
|
| 66 |
$this->assertEquals('<div class="correctness badge partiallycorrect">' . get_string('partiallycorrect', 'question') .
|
66 |
$this->assertEquals('<div class="correctness badge partiallycorrect">' . get_string('partiallycorrect', 'question') .
|
| 67 |
'</div><div class="gradingdetails">' .
|
67 |
'</div><div class="gradingdetails">' .
|
| 68 |
get_string('gradingdetails', 'qbehaviour_adaptive',
|
68 |
get_string('gradingdetails', 'qbehaviour_adaptive',
|
| 69 |
array('cur' => '0.50', 'raw' => '0.50', 'max' => '1.00')) . ' ' .
|
69 |
array('cur' => '0.50', 'raw' => '0.50', 'max' => '1.00')) . ' ' .
|
| 70 |
get_string('gradingdetailspenalty', 'qbehaviour_adaptive', '0.10') . '</div>',
|
70 |
get_string('gradingdetailspenalty', 'qbehaviour_adaptive', '0.10') . '</div>',
|
| Línea 71... |
Línea 71... |
| 71 |
$this->renderer->render_adaptive_marks(new qbehaviour_adaptive_mark_details(
|
71 |
$this->renderer->render_adaptive_marks(new qbehaviour_adaptive_mark_details(
|
| 72 |
question_state::$gradedpartial, 1, 0.5, 0.5, 0.1, 0.1, true), $this->options));
|
72 |
question_state::$gradedpartial, 1, 0.5, 0.5, 0.1, 0.1, true), $this->options));
|
| 73 |
}
|
73 |
}
|
| 74 |
|
74 |
|
| 75 |
public function test_partial_second_try() {
|
75 |
public function test_partial_second_try(): void {
|
| 76 |
$mark = array('cur' => '0.80', 'raw' => '0.90', 'max' => '1.00');
|
76 |
$mark = array('cur' => '0.80', 'raw' => '0.90', 'max' => '1.00');
|
| Línea 82... |
Línea 82... |
| 82 |
get_string('gradingdetailspenaltytotal', 'qbehaviour_adaptive', '0.20') . '</div>',
|
82 |
get_string('gradingdetailspenaltytotal', 'qbehaviour_adaptive', '0.20') . '</div>',
|
| 83 |
$this->renderer->render_adaptive_marks(new qbehaviour_adaptive_mark_details(
|
83 |
$this->renderer->render_adaptive_marks(new qbehaviour_adaptive_mark_details(
|
| 84 |
question_state::$gradedpartial, 1, 0.8, 0.9, 0.1, 0.2, true), $this->options));
|
84 |
question_state::$gradedpartial, 1, 0.8, 0.9, 0.1, 0.2, true), $this->options));
|
| 85 |
}
|
85 |
}
|
| Línea 86... |
Línea 86... |
| 86 |
|
86 |
|
| 87 |
public function test_correct_third_try() {
|
87 |
public function test_correct_third_try(): void {
|
| 88 |
$mark = array('cur' => '0.80', 'raw' => '1.00', 'max' => '1.00');
|
88 |
$mark = array('cur' => '0.80', 'raw' => '1.00', 'max' => '1.00');
|
| 89 |
$this->assertEquals('<div class="correctness badge partiallycorrect">' . get_string('partiallycorrect', 'question') .
|
89 |
$this->assertEquals('<div class="correctness badge partiallycorrect">' . get_string('partiallycorrect', 'question') .
|
| 90 |
'</div><div class="gradingdetails">' .
|
90 |
'</div><div class="gradingdetails">' .
|
| 91 |
get_string('gradingdetails', 'qbehaviour_adaptive', $mark) . ' ' .
|
91 |
get_string('gradingdetails', 'qbehaviour_adaptive', $mark) . ' ' .
|
| 92 |
get_string('gradingdetailsadjustment', 'qbehaviour_adaptive', $mark) . '</div>',
|
92 |
get_string('gradingdetailsadjustment', 'qbehaviour_adaptive', $mark) . '</div>',
|
| 93 |
$this->renderer->render_adaptive_marks(new qbehaviour_adaptive_mark_details(
|
93 |
$this->renderer->render_adaptive_marks(new qbehaviour_adaptive_mark_details(
|
| 94 |
question_state::$gradedpartial, 1, 0.8, 1.0, 0.1, 0.3, false), $this->options));
|
94 |
question_state::$gradedpartial, 1, 0.8, 1.0, 0.1, 0.3, false), $this->options));
|
| Línea 95... |
Línea 95... |
| 95 |
}
|
95 |
}
|
| 96 |
|
96 |
|
| 97 |
public function test_correct_third_try_if_we_dont_increase_penalties_for_wrong() {
|
97 |
public function test_correct_third_try_if_we_dont_increase_penalties_for_wrong(): void {
|
| 98 |
$mark = array('cur' => '0.80', 'raw' => '1.00', 'max' => '1.00');
|
98 |
$mark = array('cur' => '0.80', 'raw' => '1.00', 'max' => '1.00');
|
| 99 |
$this->assertEquals('<div class="correctness badge partiallycorrect">' . get_string('partiallycorrect', 'question') .
|
99 |
$this->assertEquals('<div class="correctness badge partiallycorrect">' . get_string('partiallycorrect', 'question') .
|
| 100 |
'</div><div class="gradingdetails">' .
|
100 |
'</div><div class="gradingdetails">' .
|