Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 28... Línea 28...
28
 * @category  test
28
 * @category  test
29
 * @copyright 2008 Jamie Pratt me@jamiep.org
29
 * @copyright 2008 Jamie Pratt me@jamiep.org
30
 * @license   http://www.gnu.org/copyleft/gpl.html GNU Public License
30
 * @license   http://www.gnu.org/copyleft/gpl.html GNU Public License
31
 */
31
 */
32
class reportlib_test extends \advanced_testcase {
32
class reportlib_test extends \advanced_testcase {
33
    public function test_quiz_report_index_by_keys() {
33
    public function test_quiz_report_index_by_keys(): void {
34
        $datum = [];
34
        $datum = [];
35
        $object = new \stdClass();
35
        $object = new \stdClass();
36
        $object->qid = 3;
36
        $object->qid = 3;
37
        $object->aid = 101;
37
        $object->aid = 101;
38
        $object->response = '';
38
        $object->response = '';
Línea 52... Línea 52...
52
        $this->assertEquals($indexed[101][3][0]->aid, 101);
52
        $this->assertEquals($indexed[101][3][0]->aid, 101);
53
        $this->assertEquals($indexed[101][3][0]->response, '');
53
        $this->assertEquals($indexed[101][3][0]->response, '');
54
        $this->assertEquals($indexed[101][3][0]->grade, 3);
54
        $this->assertEquals($indexed[101][3][0]->grade, 3);
55
    }
55
    }
Línea 56... Línea 56...
56
 
56
 
57
    public function test_quiz_report_scale_summarks_as_percentage() {
57
    public function test_quiz_report_scale_summarks_as_percentage(): void {
58
        $quiz = new \stdClass();
58
        $quiz = new \stdClass();
59
        $quiz->sumgrades = 10;
59
        $quiz->sumgrades = 10;
Línea 60... Línea 60...
60
        $quiz->decimalpoints = 2;
60
        $quiz->decimalpoints = 2;
Línea 65... Línea 65...
65
            quiz_report_scale_summarks_as_percentage(1.234567, $quiz, true));
65
            quiz_report_scale_summarks_as_percentage(1.234567, $quiz, true));
66
        $this->assertEquals('-',
66
        $this->assertEquals('-',
67
            quiz_report_scale_summarks_as_percentage('-', $quiz, true));
67
            quiz_report_scale_summarks_as_percentage('-', $quiz, true));
68
    }
68
    }
Línea 69... Línea 69...
69
 
69
 
70
    public function test_quiz_report_qm_filter_select_only_one_attempt_allowed() {
70
    public function test_quiz_report_qm_filter_select_only_one_attempt_allowed(): void {
71
        $quiz = new \stdClass();
71
        $quiz = new \stdClass();
72
        $quiz->attempts = 1;
72
        $quiz->attempts = 1;
73
        $this->assertSame('', quiz_report_qm_filter_select($quiz));
73
        $this->assertSame('', quiz_report_qm_filter_select($quiz));
Línea 74... Línea 74...
74
    }
74
    }
75
 
75
 
76
    public function test_quiz_report_qm_filter_select_average() {
76
    public function test_quiz_report_qm_filter_select_average(): void {
77
        $quiz = new \stdClass();
77
        $quiz = new \stdClass();
78
        $quiz->attempts = 10;
78
        $quiz->attempts = 10;
79
        $quiz->grademethod = QUIZ_GRADEAVERAGE;
79
        $quiz->grademethod = QUIZ_GRADEAVERAGE;
Línea 80... Línea 80...
80
        $this->assertSame('', quiz_report_qm_filter_select($quiz));
80
        $this->assertSame('', quiz_report_qm_filter_select($quiz));
81
    }
81
    }
82
 
82
 
Línea 83... Línea 83...
83
    public function test_quiz_report_qm_filter_select_first_last_best() {
83
    public function test_quiz_report_qm_filter_select_first_last_best(): void {
84
        global $DB;
84
        global $DB;
Línea 157... Línea 157...
157
        $this->assertEquals(1, count($bestattempt));
157
        $this->assertEquals(1, count($bestattempt));
158
        $bestattempt = reset($bestattempt);
158
        $bestattempt = reset($bestattempt);
159
        $this->assertEquals(2, $bestattempt->attempt);
159
        $this->assertEquals(2, $bestattempt->attempt);
160
    }
160
    }
Línea 161... Línea 161...
161
 
161
 
162
    public function test_quiz_results_never_below_zero() {
162
    public function test_quiz_results_never_below_zero(): void {
163
        global $DB;
163
        global $DB;
Línea 164... Línea 164...
164
        $this->resetAfterTest();
164
        $this->resetAfterTest();
165
 
165