Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 47... Línea 47...
47
 
47
 
48
    public function setUp(): void {
48
    public function setUp(): void {
49
        $this->resetAfterTest();
49
        $this->resetAfterTest();
Línea 50... Línea 50...
50
    }
50
    }
51
 
51
 
52
    public function test_get_contexts_for_userid() {
52
    public function test_get_contexts_for_userid(): void {
53
        $dg = $this->getDataGenerator();
53
        $dg = $this->getDataGenerator();
54
        $c1 = $dg->create_course();
54
        $c1 = $dg->create_course();
55
        $c2 = $dg->create_course();
55
        $c2 = $dg->create_course();
Línea 95... Línea 95...
95
    }
95
    }
Línea 96... Línea 96...
96
 
96
 
97
    /**
97
    /**
98
     * Test that user IDs are returned for a given context.
98
     * Test that user IDs are returned for a given context.
99
     */
99
     */
100
    public function test_get_users_in_context() {
100
    public function test_get_users_in_context(): void {
101
        global $DB;
101
        global $DB;
102
        $u1 = $this->getDataGenerator()->create_user();
102
        $u1 = $this->getDataGenerator()->create_user();
103
        $u2 = $this->getDataGenerator()->create_user();
103
        $u2 = $this->getDataGenerator()->create_user();
Línea 123... Línea 123...
123
        provider::get_users_in_context($userlist);
123
        provider::get_users_in_context($userlist);
124
        $this->assertCount(3, $userlist->get_userids());
124
        $this->assertCount(3, $userlist->get_userids());
125
    }
125
    }
Línea 126... Línea 126...
126
 
126
 
127
 
127
 
128
    public function test_delete_data_for_user() {
128
    public function test_delete_data_for_user(): void {
129
        global $DB;
129
        global $DB;
130
        $dg = $this->getDataGenerator();
130
        $dg = $this->getDataGenerator();
131
        $c1 = $dg->create_course();
131
        $c1 = $dg->create_course();
Línea 193... Línea 193...
193
            'name' => "docked_block_instance_{$blockmentees->instance->id}"]));
193
            'name' => "docked_block_instance_{$blockmentees->instance->id}"]));
194
        $this->assertTrue($DB->record_exists('user_preferences', ['userid' => $u2->id,
194
        $this->assertTrue($DB->record_exists('user_preferences', ['userid' => $u2->id,
195
            'name' => "docked_block_instance_{$blockmentees->instance->id}"]));
195
            'name' => "docked_block_instance_{$blockmentees->instance->id}"]));
196
    }
196
    }
Línea 197... Línea 197...
197
 
197
 
198
    public function test_delete_data_for_all_users_in_context() {
198
    public function test_delete_data_for_all_users_in_context(): void {
199
        global $DB;
199
        global $DB;
200
        $dg = $this->getDataGenerator();
200
        $dg = $this->getDataGenerator();
201
        $c1 = $dg->create_course();
201
        $c1 = $dg->create_course();
202
        $c2 = $dg->create_course();
202
        $c2 = $dg->create_course();
Línea 299... Línea 299...
299
    }
299
    }
Línea 300... Línea 300...
300
 
300
 
301
    /**
301
    /**
302
     * Test the deletion of data related to a context and a list of users.
302
     * Test the deletion of data related to a context and a list of users.
303
     */
303
     */
304
    public function test_delete_data_for_users() {
304
    public function test_delete_data_for_users(): void {
305
        global $DB;
305
        global $DB;
306
        $u1 = $this->getDataGenerator()->create_user();
306
        $u1 = $this->getDataGenerator()->create_user();
307
        $u2 = $this->getDataGenerator()->create_user();
307
        $u2 = $this->getDataGenerator()->create_user();
Línea 337... Línea 337...
337
        // All of these are gone.
337
        // All of these are gone.
338
        $this->assertEmpty($DB->get_records('user_preferences',
338
        $this->assertEmpty($DB->get_records('user_preferences',
339
                ['name' => "block{$blockcontext->instanceid}hidden"]));
339
                ['name' => "block{$blockcontext->instanceid}hidden"]));
340
    }
340
    }
Línea 341... Línea 341...
341
 
341
 
342
    public function test_export_data_for_user() {
342
    public function test_export_data_for_user(): void {
343
        global $DB;
343
        global $DB;
344
        $dg = $this->getDataGenerator();
344
        $dg = $this->getDataGenerator();
345
        $c1 = $dg->create_course();
345
        $c1 = $dg->create_course();
346
        $c2 = $dg->create_course();
346
        $c2 = $dg->create_course();