Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 90... Línea 90...
90
    }
90
    }
Línea 91... Línea 91...
91
 
91
 
92
    /**
92
    /**
93
     * Test view_scorm
93
     * Test view_scorm
94
     */
94
     */
95
    public function test_view_scorm() {
95
    public function test_view_scorm(): void {
Línea 96... Línea 96...
96
        global $DB;
96
        global $DB;
97
 
97
 
98
        // Test invalid instance id.
98
        // Test invalid instance id.
Línea 137... Línea 137...
137
    }
137
    }
Línea 138... Línea 138...
138
 
138
 
139
    /**
139
    /**
140
     * Test get scorm attempt count
140
     * Test get scorm attempt count
141
     */
141
     */
142
    public function test_mod_scorm_get_scorm_attempt_count_own_empty() {
142
    public function test_mod_scorm_get_scorm_attempt_count_own_empty(): void {
143
        // Set to the student user.
143
        // Set to the student user.
Línea 144... Línea 144...
144
        self::setUser($this->student);
144
        self::setUser($this->student);
145
 
145
 
146
        // Retrieve my attempts (should be 0).
146
        // Retrieve my attempts (should be 0).
147
        $result = mod_scorm_external::get_scorm_attempt_count($this->scorm->id, $this->student->id);
147
        $result = mod_scorm_external::get_scorm_attempt_count($this->scorm->id, $this->student->id);
148
        $result = external_api::clean_returnvalue(mod_scorm_external::get_scorm_attempt_count_returns(), $result);
148
        $result = external_api::clean_returnvalue(mod_scorm_external::get_scorm_attempt_count_returns(), $result);
Línea 149... Línea 149...
149
        $this->assertEquals(0, $result['attemptscount']);
149
        $this->assertEquals(0, $result['attemptscount']);
150
    }
150
    }
151
 
151
 
Línea 152... Línea 152...
152
    public function test_mod_scorm_get_scorm_attempt_count_own_with_complete() {
152
    public function test_mod_scorm_get_scorm_attempt_count_own_with_complete(): void {
153
        // Set to the student user.
153
        // Set to the student user.
Línea 162... Línea 162...
162
        $result = mod_scorm_external::get_scorm_attempt_count($this->scorm->id, $this->student->id);
162
        $result = mod_scorm_external::get_scorm_attempt_count($this->scorm->id, $this->student->id);
163
        $result = external_api::clean_returnvalue(mod_scorm_external::get_scorm_attempt_count_returns(), $result);
163
        $result = external_api::clean_returnvalue(mod_scorm_external::get_scorm_attempt_count_returns(), $result);
164
        $this->assertEquals(2, $result['attemptscount']);
164
        $this->assertEquals(2, $result['attemptscount']);
165
    }
165
    }
Línea 166... Línea 166...
166
 
166
 
167
    public function test_mod_scorm_get_scorm_attempt_count_own_incomplete() {
167
    public function test_mod_scorm_get_scorm_attempt_count_own_incomplete(): void {
168
        // Set to the student user.
168
        // Set to the student user.
Línea 169... Línea 169...
169
        self::setUser($this->student);
169
        self::setUser($this->student);
170
 
170
 
Línea 177... Línea 177...
177
        $result = mod_scorm_external::get_scorm_attempt_count($this->scorm->id, $this->student->id, true);
177
        $result = mod_scorm_external::get_scorm_attempt_count($this->scorm->id, $this->student->id, true);
178
        $result = external_api::clean_returnvalue(mod_scorm_external::get_scorm_attempt_count_returns(), $result);
178
        $result = external_api::clean_returnvalue(mod_scorm_external::get_scorm_attempt_count_returns(), $result);
179
        $this->assertEquals(1, $result['attemptscount']);
179
        $this->assertEquals(1, $result['attemptscount']);
180
    }
180
    }
Línea 181... Línea 181...
181
 
181
 
182
    public function test_mod_scorm_get_scorm_attempt_count_others_as_teacher() {
182
    public function test_mod_scorm_get_scorm_attempt_count_others_as_teacher(): void {
183
        // As a teacher.
183
        // As a teacher.
Línea 184... Línea 184...
184
        self::setUser($this->teacher);
184
        self::setUser($this->teacher);
185
 
185
 
Línea 192... Línea 192...
192
        $result = mod_scorm_external::get_scorm_attempt_count($this->scorm->id, $this->student->id);
192
        $result = mod_scorm_external::get_scorm_attempt_count($this->scorm->id, $this->student->id);
193
        $result = external_api::clean_returnvalue(mod_scorm_external::get_scorm_attempt_count_returns(), $result);
193
        $result = external_api::clean_returnvalue(mod_scorm_external::get_scorm_attempt_count_returns(), $result);
194
        $this->assertEquals(1, $result['attemptscount']);
194
        $this->assertEquals(1, $result['attemptscount']);
195
    }
195
    }
Línea 196... Línea 196...
196
 
196
 
197
    public function test_mod_scorm_get_scorm_attempt_count_others_as_student() {
197
    public function test_mod_scorm_get_scorm_attempt_count_others_as_student(): void {
198
        // Create a second student.
198
        // Create a second student.
199
        $student2 = self::getDataGenerator()->create_user();
199
        $student2 = self::getDataGenerator()->create_user();
Línea 200... Línea 200...
200
        $this->getDataGenerator()->enrol_user($student2->id, $this->course->id, $this->studentrole->id, 'manual');
200
        $this->getDataGenerator()->enrol_user($student2->id, $this->course->id, $this->studentrole->id, 'manual');
Línea 205... Línea 205...
205
        // I should not be able to view the attempts of another student.
205
        // I should not be able to view the attempts of another student.
206
        $this->expectException(\required_capability_exception::class);
206
        $this->expectException(\required_capability_exception::class);
207
        mod_scorm_external::get_scorm_attempt_count($this->scorm->id, $this->student->id);
207
        mod_scorm_external::get_scorm_attempt_count($this->scorm->id, $this->student->id);
208
    }
208
    }
Línea 209... Línea 209...
209
 
209
 
210
    public function test_mod_scorm_get_scorm_attempt_count_invalid_instanceid() {
210
    public function test_mod_scorm_get_scorm_attempt_count_invalid_instanceid(): void {
211
        // As student.
211
        // As student.
Línea 212... Línea 212...
212
        self::setUser($this->student);
212
        self::setUser($this->student);
213
 
213
 
214
        // Test invalid instance id.
214
        // Test invalid instance id.
215
        $this->expectException(\moodle_exception::class);
215
        $this->expectException(\moodle_exception::class);
Línea 216... Línea 216...
216
        mod_scorm_external::get_scorm_attempt_count(0, $this->student->id);
216
        mod_scorm_external::get_scorm_attempt_count(0, $this->student->id);
217
    }
217
    }
218
 
218
 
Línea 219... Línea 219...
219
    public function test_mod_scorm_get_scorm_attempt_count_invalid_userid() {
219
    public function test_mod_scorm_get_scorm_attempt_count_invalid_userid(): void {
220
        // As student.
220
        // As student.
221
        self::setUser($this->student);
221
        self::setUser($this->student);
Línea 222... Línea 222...
222
 
222
 
223
        $this->expectException(\moodle_exception::class);
223
        $this->expectException(\moodle_exception::class);
224
        mod_scorm_external::get_scorm_attempt_count($this->scorm->id, -1);
224
        mod_scorm_external::get_scorm_attempt_count($this->scorm->id, -1);
225
    }
225
    }
226
 
226
 
Línea 227... Línea 227...
227
    /**
227
    /**
Línea 228... Línea 228...
228
     * Test get scorm scoes
228
     * Test get scorm scoes
Línea 325... Línea 325...
325
    }
325
    }
Línea 326... Línea 326...
326
 
326
 
327
    /**
327
    /**
328
     * Test get scorm scoes (with a complex SCORM package)
328
     * Test get scorm scoes (with a complex SCORM package)
329
     */
329
     */
330
    public function test_mod_scorm_get_scorm_scoes_complex_package() {
330
    public function test_mod_scorm_get_scorm_scoes_complex_package(): void {
Línea 331... Línea 331...
331
        global $CFG;
331
        global $CFG;
332
 
332
 
Línea 365... Línea 365...
365
    }
365
    }
Línea 366... Línea 366...
366
 
366
 
367
    /*
367
    /*
368
     * Test get scorm user data
368
     * Test get scorm user data
369
     */
369
     */
370
    public function test_mod_scorm_get_scorm_user_data() {
370
    public function test_mod_scorm_get_scorm_user_data(): void {
Línea 371... Línea 371...
371
        global $DB;
371
        global $DB;
Línea 372... Línea 372...
372
 
372
 
Línea 427... Línea 427...
427
    }
427
    }
Línea 428... Línea 428...
428
 
428
 
429
    /**
429
    /**
430
     * Test insert scorm tracks
430
     * Test insert scorm tracks
431
     */
431
     */
432
    public function test_mod_scorm_insert_scorm_tracks() {
432
    public function test_mod_scorm_insert_scorm_tracks(): void {
Línea 433... Línea 433...
433
        global $DB;
433
        global $DB;
Línea 434... Línea 434...
434
 
434
 
Línea 516... Línea 516...
516
    }
516
    }
Línea 517... Línea 517...
517
 
517
 
518
    /**
518
    /**
519
     * Test get scorm sco tracks
519
     * Test get scorm sco tracks
520
     */
520
     */
521
    public function test_mod_scorm_get_scorm_sco_tracks() {
521
    public function test_mod_scorm_get_scorm_sco_tracks(): void {
Línea 522... Línea 522...
522
        global $DB;
522
        global $DB;
Línea 523... Línea 523...
523
 
523
 
Línea 611... Línea 611...
611
    }
611
    }
Línea 612... Línea 612...
612
 
612
 
613
    /*
613
    /*
614
     * Test get scorms by courses
614
     * Test get scorms by courses
615
     */
615
     */
616
    public function test_mod_scorm_get_scorms_by_courses() {
616
    public function test_mod_scorm_get_scorms_by_courses(): void {
Línea 617... Línea 617...
617
        global $DB;
617
        global $DB;
Línea 618... Línea 618...
618
 
618
 
Línea 845... Línea 845...
845
    }
845
    }
Línea 846... Línea 846...
846
 
846
 
847
    /**
847
    /**
848
     * Test launch_sco
848
     * Test launch_sco
849
     */
849
     */
850
    public function test_launch_sco() {
850
    public function test_launch_sco(): void {
Línea 851... Línea 851...
851
        global $DB;
851
        global $DB;
852
 
852
 
853
        // Test invalid instance id.
853
        // Test invalid instance id.
Línea 915... Línea 915...
915
    }
915
    }
Línea 916... Línea 916...
916
 
916
 
917
    /**
917
    /**
918
     * Test mod_scorm_get_scorm_access_information.
918
     * Test mod_scorm_get_scorm_access_information.
919
     */
919
     */
920
    public function test_mod_scorm_get_scorm_access_information() {
920
    public function test_mod_scorm_get_scorm_access_information(): void {
Línea 921... Línea 921...
921
        global $DB;
921
        global $DB;
Línea 922... Línea 922...
922
 
922