Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 52... Línea 52...
52
        global $PAGE;
52
        global $PAGE;
53
        $this->resetAfterTest();
53
        $this->resetAfterTest();
54
        $PAGE->get_renderer('core');
54
        $PAGE->get_renderer('core');
55
    }
55
    }
Línea 56... Línea 56...
56
 
56
 
57
    public function test_get_contexts_for_userid_gradebook_edits() {
57
    public function test_get_contexts_for_userid_gradebook_edits(): void {
Línea 58... Línea 58...
58
        $dg = $this->getDataGenerator();
58
        $dg = $this->getDataGenerator();
59
 
59
 
Línea 177... Línea 177...
177
        $contexts = array_flip(provider::get_contexts_for_userid($u10->id)->get_contextids());
177
        $contexts = array_flip(provider::get_contexts_for_userid($u10->id)->get_contextids());
178
        $this->assertCount(1, $contexts);
178
        $this->assertCount(1, $contexts);
179
        $this->assertArrayHasKey($c1ctx->id, $contexts);
179
        $this->assertArrayHasKey($c1ctx->id, $contexts);
180
    }
180
    }
Línea 181... Línea 181...
181
 
181
 
182
    public function test_get_contexts_for_userid_grades_and_history() {
182
    public function test_get_contexts_for_userid_grades_and_history(): void {
Línea 183... Línea 183...
183
        $dg = $this->getDataGenerator();
183
        $dg = $this->getDataGenerator();
184
 
184
 
Línea 251... Línea 251...
251
    }
251
    }
Línea 252... Línea 252...
252
 
252
 
253
    /**
253
    /**
254
     * Test that the appropriate user IDs are returned for a given context.
254
     * Test that the appropriate user IDs are returned for a given context.
255
     */
255
     */
256
    public function test_get_users_in_context_gradebook_edits() {
256
    public function test_get_users_in_context_gradebook_edits(): void {
Línea 257... Línea 257...
257
        $dg = $this->getDataGenerator();
257
        $dg = $this->getDataGenerator();
258
 
258
 
Línea 346... Línea 346...
346
    }
346
    }
Línea 347... Línea 347...
347
 
347
 
348
    /**
348
    /**
349
     * Test that the appropriate user IDs are returned for a given context.
349
     * Test that the appropriate user IDs are returned for a given context.
350
     */
350
     */
351
    public function test_get_users_in_context_grades_and_history() {
351
    public function test_get_users_in_context_grades_and_history(): void {
Línea 352... Línea 352...
352
        $dg = $this->getDataGenerator();
352
        $dg = $this->getDataGenerator();
353
 
353
 
Línea 402... Línea 402...
402
        $userlist = new \core_privacy\local\request\userlist($u2ctx, 'core_grades');
402
        $userlist = new \core_privacy\local\request\userlist($u2ctx, 'core_grades');
403
        provider::get_users_in_context($userlist);
403
        provider::get_users_in_context($userlist);
404
        $this->assertEquals([$u2->id], $userlist->get_userids());
404
        $this->assertEquals([$u2->id], $userlist->get_userids());
405
    }
405
    }
Línea 406... Línea 406...
406
 
406
 
407
    public function test_delete_data_for_all_users_in_context() {
407
    public function test_delete_data_for_all_users_in_context(): void {
Línea 408... Línea 408...
408
        global $DB;
408
        global $DB;
Línea 409... Línea 409...
409
 
409
 
Línea 642... Línea 642...
642
 
642
 
643
        $files = $fs->get_area_files($a4context->id, GRADE_FILE_COMPONENT, GRADE_HISTORY_FEEDBACK_FILEAREA);
643
        $files = $fs->get_area_files($a4context->id, GRADE_FILE_COMPONENT, GRADE_HISTORY_FEEDBACK_FILEAREA);
644
        $this->assertEquals(0, count($files));
644
        $this->assertEquals(0, count($files));
Línea 645... Línea 645...
645
    }
645
    }
646
 
646
 
Línea 647... Línea 647...
647
    public function test_delete_data_for_user() {
647
    public function test_delete_data_for_user(): void {
Línea 648... Línea 648...
648
        global $DB;
648
        global $DB;
Línea 893... Línea 893...
893
    }
893
    }
Línea 894... Línea 894...
894
 
894
 
895
    /**
895
    /**
896
     * Test deleting multiple users for a context works.
896
     * Test deleting multiple users for a context works.
897
     */
897
     */
898
    public function test_delete_data_for_users() {
898
    public function test_delete_data_for_users(): void {
899
        global $DB;
899
        global $DB;
Línea 900... Línea 900...
900
        $dg = $this->getDataGenerator();
900
        $dg = $this->getDataGenerator();
901
 
901
 
Línea 964... Línea 964...
964
        $this->assertTrue($DB->record_exists('grade_grades', ['userid' => $u1->id, 'itemid' => $gi2a->id]));
964
        $this->assertTrue($DB->record_exists('grade_grades', ['userid' => $u1->id, 'itemid' => $gi2a->id]));
965
        $this->assertFalse($DB->record_exists('grade_grades', ['userid' => $u2->id, 'itemid' => $gi2a->id]));
965
        $this->assertFalse($DB->record_exists('grade_grades', ['userid' => $u2->id, 'itemid' => $gi2a->id]));
966
        $this->assertFalse($DB->record_exists('grade_grades', ['userid' => $u4->id, 'itemid' => $gi2a->id]));
966
        $this->assertFalse($DB->record_exists('grade_grades', ['userid' => $u4->id, 'itemid' => $gi2a->id]));
967
    }
967
    }
Línea 968... Línea 968...
968
 
968
 
969
    public function test_export_data_for_user_about_grades_and_history() {
969
    public function test_export_data_for_user_about_grades_and_history(): void {
Línea 970... Línea 970...
970
        $dg = $this->getDataGenerator();
970
        $dg = $this->getDataGenerator();
971
 
971
 
Línea 1281... Línea 1281...
1281
        $this->assertEquals(transform::yesno(false), $grade['logged_in_user_was_you']);
1281
        $this->assertEquals(transform::yesno(false), $grade['logged_in_user_was_you']);
1282
        $this->assertEquals(transform::yesno(true), $grade['author_of_change_was_you']);
1282
        $this->assertEquals(transform::yesno(true), $grade['author_of_change_was_you']);
1283
        $this->assertEquals(get_string('privacy:request:historyactiondelete', 'core_grades'), $grade['action']);
1283
        $this->assertEquals(get_string('privacy:request:historyactiondelete', 'core_grades'), $grade['action']);
1284
    }
1284
    }
Línea 1285... Línea 1285...
1285
 
1285
 
1286
    public function test_export_data_for_user_with_scale() {
1286
    public function test_export_data_for_user_with_scale(): void {
1287
        global $DB;
1287
        global $DB;
1288
        $dg = $this->getDataGenerator();
1288
        $dg = $this->getDataGenerator();
1289
        $c1 = $dg->create_course();
1289
        $c1 = $dg->create_course();
1290
        $scale = $dg->create_scale(['scale' => 'Awesome,OK,Reasonable,Bad']);
1290
        $scale = $dg->create_scale(['scale' => 'Awesome,OK,Reasonable,Bad']);
Línea 1314... Línea 1314...
1314
        $this->assertEquals($gi2->get_name(), $data->grades[2]['item']);
1314
        $this->assertEquals($gi2->get_name(), $data->grades[2]['item']);
1315
        $this->assertEquals(3, $data->grades[2]['grade']);
1315
        $this->assertEquals(3, $data->grades[2]['grade']);
1316
        $this->assertEquals('Reasonable', $data->grades[2]['grade_formatted']);
1316
        $this->assertEquals('Reasonable', $data->grades[2]['grade_formatted']);
1317
    }
1317
    }
Línea 1318... Línea 1318...
1318
 
1318
 
1319
    public function test_export_data_for_user_about_gradebook_edits() {
1319
    public function test_export_data_for_user_about_gradebook_edits(): void {
1320
        global $DB;
1320
        global $DB;
1321
        $dg = $this->getDataGenerator();
1321
        $dg = $this->getDataGenerator();
1322
        $c1 = $dg->create_course();
1322
        $c1 = $dg->create_course();
1323
        $c2 = $dg->create_course();
1323
        $c2 = $dg->create_course();