Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 82... Línea 82...
82
    }
82
    }
Línea 83... Línea 83...
83
 
83
 
84
    /**
84
    /**
85
     * Test that a collection with data is returned when calling this function.
85
     * Test that a collection with data is returned when calling this function.
86
     */
86
     */
87
    public function test_get_metadata() {
87
    public function test_get_metadata(): void {
88
        $collection = new \core_privacy\local\metadata\collection('tool_monitor');
88
        $collection = new \core_privacy\local\metadata\collection('tool_monitor');
89
        $collection = provider::get_metadata($collection);
89
        $collection = provider::get_metadata($collection);
90
        $this->assertNotEmpty($collection);
90
        $this->assertNotEmpty($collection);
Línea 91... Línea 91...
91
    }
91
    }
92
 
92
 
93
    /**
93
    /**
94
     * Check that a user context is returned if there is any user data for this user.
94
     * Check that a user context is returned if there is any user data for this user.
95
     */
95
     */
96
    public function test_get_contexts_for_userid() {
96
    public function test_get_contexts_for_userid(): void {
97
        $user = $this->getDataGenerator()->create_user();
97
        $user = $this->getDataGenerator()->create_user();
98
        $user2 = $this->getDataGenerator()->create_user();
98
        $user2 = $this->getDataGenerator()->create_user();
99
        $usercontext = \context_user::instance($user->id);
99
        $usercontext = \context_user::instance($user->id);
Línea 132... Línea 132...
132
    }
132
    }
Línea 133... Línea 133...
133
 
133
 
134
    /**
134
    /**
135
     * Check that the correct userlist is returned if there is any user data for this context.
135
     * Check that the correct userlist is returned if there is any user data for this context.
136
     */
136
     */
137
    public function test_get_users_in_context() {
137
    public function test_get_users_in_context(): void {
138
        $component = 'tool_monitor';
138
        $component = 'tool_monitor';
139
        $user = $this->getDataGenerator()->create_user();
139
        $user = $this->getDataGenerator()->create_user();
140
        $user2 = $this->getDataGenerator()->create_user();
140
        $user2 = $this->getDataGenerator()->create_user();
141
        $usercontext = \context_user::instance($user->id);
141
        $usercontext = \context_user::instance($user->id);
Línea 181... Línea 181...
181
    }
181
    }
Línea 182... Línea 182...
182
 
182
 
183
    /**
183
    /**
184
     * Test that user data is exported correctly.
184
     * Test that user data is exported correctly.
185
     */
185
     */
186
    public function test_export_user_data() {
186
    public function test_export_user_data(): void {
187
        $user = $this->getDataGenerator()->create_user();
187
        $user = $this->getDataGenerator()->create_user();
188
        $usercontext = \context_user::instance($user->id);
188
        $usercontext = \context_user::instance($user->id);
Línea 189... Línea 189...
189
        $monitorgenerator = $this->getDataGenerator()->get_plugin_generator('tool_monitor');
189
        $monitorgenerator = $this->getDataGenerator()->get_plugin_generator('tool_monitor');
Línea 216... Línea 216...
216
    }
216
    }
Línea 217... Línea 217...
217
 
217
 
218
    /**
218
    /**
219
     * Test deleting all user data for a specific context.
219
     * Test deleting all user data for a specific context.
220
     */
220
     */
221
    public function test_delete_data_for_all_users_in_context() {
221
    public function test_delete_data_for_all_users_in_context(): void {
Línea 222... Línea 222...
222
        global $DB;
222
        global $DB;
223
 
223
 
224
        $user = $this->getDataGenerator()->create_user();
224
        $user = $this->getDataGenerator()->create_user();
Línea 283... Línea 283...
283
    }
283
    }
Línea 284... Línea 284...
284
 
284
 
285
    /**
285
    /**
286
     * This should work identical to the above test.
286
     * This should work identical to the above test.
287
     */
287
     */
288
    public function test_delete_data_for_user() {
288
    public function test_delete_data_for_user(): void {
Línea 289... Línea 289...
289
        global $DB;
289
        global $DB;
290
 
290
 
291
        $user = $this->getDataGenerator()->create_user();
291
        $user = $this->getDataGenerator()->create_user();
Línea 340... Línea 340...
340
    }
340
    }
Línea 341... Línea 341...
341
 
341
 
342
    /**
342
    /**
343
     * Test deleting user data for an approved userlist in a context.
343
     * Test deleting user data for an approved userlist in a context.
344
     */
344
     */
345
    public function test_delete_data_for_users() {
345
    public function test_delete_data_for_users(): void {
Línea 346... Línea 346...
346
        global $DB;
346
        global $DB;
347
 
347
 
348
        $component = 'tool_monitor';
348
        $component = 'tool_monitor';