Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 180... Línea 180...
180
    }
180
    }
Línea 181... Línea 181...
181
 
181
 
182
    /**
182
    /**
183
     * Test getting a user_favourite_service from the static locator.
183
     * Test getting a user_favourite_service from the static locator.
184
     */
184
     */
185
    public function test_get_service_for_user_context() {
185
    public function test_get_service_for_user_context(): void {
186
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
186
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
187
        $userservice = \core_favourites\service_factory::get_service_for_user_context($user1context);
187
        $userservice = \core_favourites\service_factory::get_service_for_user_context($user1context);
188
        $this->assertInstanceOf(\core_favourites\local\service\user_favourite_service::class, $userservice);
188
        $this->assertInstanceOf(\core_favourites\local\service\user_favourite_service::class, $userservice);
Línea 189... Línea 189...
189
    }
189
    }
190
 
190
 
191
    /**
191
    /**
192
     * Test confirming an item can be favourited only once.
192
     * Test confirming an item can be favourited only once.
193
     */
193
     */
Línea 194... Línea 194...
194
    public function test_create_favourite_basic() {
194
    public function test_create_favourite_basic(): void {
195
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
195
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
196
 
196
 
Línea 208... Línea 208...
208
    }
208
    }
Línea 209... Línea 209...
209
 
209
 
210
    /**
210
    /**
211
     * Test confirming that an exception is thrown if trying to favourite an item for a non-existent component.
211
     * Test confirming that an exception is thrown if trying to favourite an item for a non-existent component.
212
     */
212
     */
213
    public function test_create_favourite_nonexistent_component() {
213
    public function test_create_favourite_nonexistent_component(): void {
Línea 214... Línea 214...
214
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
214
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
215
 
215
 
216
        // Get a user_favourite_service for the user.
216
        // Get a user_favourite_service for the user.
Línea 223... Línea 223...
223
    }
223
    }
Línea 224... Línea 224...
224
 
224
 
225
    /**
225
    /**
226
     * Test fetching favourites for single user, by area.
226
     * Test fetching favourites for single user, by area.
227
     */
227
     */
228
    public function test_find_favourites_by_type_single_user() {
228
    public function test_find_favourites_by_type_single_user(): void {
Línea 229... Línea 229...
229
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
229
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
230
 
230
 
231
        // Get a user_favourite_service for the user.
231
        // Get a user_favourite_service for the user.
Línea 249... Línea 249...
249
    }
249
    }
Línea 250... Línea 250...
250
 
250
 
251
    /**
251
    /**
252
     * Test fetching favourites for single user, by area.
252
     * Test fetching favourites for single user, by area.
253
     */
253
     */
254
    public function test_find_all_favourites() {
254
    public function test_find_all_favourites(): void {
Línea 255... Línea 255...
255
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
255
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
256
 
256
 
257
        // Get a user_favourite_service for the user.
257
        // Get a user_favourite_service for the user.
Línea 285... Línea 285...
285
    }
285
    }
Línea 286... Línea 286...
286
 
286
 
287
    /**
287
    /**
288
     * Make sure the find_favourites_by_type() method only returns favourites for the scoped user.
288
     * Make sure the find_favourites_by_type() method only returns favourites for the scoped user.
289
     */
289
     */
290
    public function test_find_favourites_by_type_multiple_users() {
290
    public function test_find_favourites_by_type_multiple_users(): void {
Línea 291... Línea 291...
291
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
291
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
292
 
292
 
293
        // Get a user_favourite_service for 2 users.
293
        // Get a user_favourite_service for 2 users.
Línea 312... Línea 312...
312
    }
312
    }
Línea 313... Línea 313...
313
 
313
 
314
    /**
314
    /**
315
     * Test confirming that an exception is thrown if trying to get favourites for a non-existent component.
315
     * Test confirming that an exception is thrown if trying to get favourites for a non-existent component.
316
     */
316
     */
317
    public function test_find_favourites_by_type_nonexistent_component() {
317
    public function test_find_favourites_by_type_nonexistent_component(): void {
Línea 318... Línea 318...
318
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
318
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
319
 
319
 
320
        // Get a user_favourite_service for the user.
320
        // Get a user_favourite_service for the user.
Línea 327... Línea 327...
327
    }
327
    }
Línea 328... Línea 328...
328
 
328
 
329
    /**
329
    /**
330
     * Test confirming the pagination support for the find_favourites_by_type() method.
330
     * Test confirming the pagination support for the find_favourites_by_type() method.
331
     */
331
     */
332
    public function test_find_favourites_by_type_pagination() {
332
    public function test_find_favourites_by_type_pagination(): void {
Línea 333... Línea 333...
333
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
333
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
334
 
334
 
335
        // Get a user_favourite_service for the user.
335
        // Get a user_favourite_service for the user.
Línea 358... Línea 358...
358
    }
358
    }
Línea 359... Línea 359...
359
 
359
 
360
    /**
360
    /**
361
     * Test confirming the basic deletion behaviour.
361
     * Test confirming the basic deletion behaviour.
362
     */
362
     */
363
    public function test_delete_favourite_basic() {
363
    public function test_delete_favourite_basic(): void {
Línea 364... Línea 364...
364
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
364
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
365
 
365
 
366
        // Get a user_favourite_service for the user.
366
        // Get a user_favourite_service for the user.
Línea 383... Línea 383...
383
    }
383
    }
Línea 384... Línea 384...
384
 
384
 
385
    /**
385
    /**
386
     * Test confirming the behaviour of the favourite_exists() method.
386
     * Test confirming the behaviour of the favourite_exists() method.
387
     */
387
     */
388
    public function test_favourite_exists() {
388
    public function test_favourite_exists(): void {
Línea 389... Línea 389...
389
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
389
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
390
 
390
 
391
        // Get a user_favourite_service for the user.
391
        // Get a user_favourite_service for the user.
Línea 417... Línea 417...
417
    }
417
    }
Línea 418... Línea 418...
418
 
418
 
419
    /**
419
    /**
420
     * Test confirming the behaviour of the get_favourite() method.
420
     * Test confirming the behaviour of the get_favourite() method.
421
     */
421
     */
422
    public function test_get_favourite() {
422
    public function test_get_favourite(): void {
Línea 423... Línea 423...
423
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
423
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
424
 
424
 
425
        // Get a user_favourite_service for the user.
425
        // Get a user_favourite_service for the user.
Línea 450... Línea 450...
450
    }
450
    }
Línea 451... Línea 451...
451
 
451
 
452
    /**
452
    /**
453
     * Test confirming the behaviour of the count_favourites_by_type() method.
453
     * Test confirming the behaviour of the count_favourites_by_type() method.
454
     */
454
     */
455
    public function test_count_favourites_by_type() {
455
    public function test_count_favourites_by_type(): void {
Línea 456... Línea 456...
456
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
456
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
457
 
457
 
458
        // Get a user_favourite_service for the user.
458
        // Get a user_favourite_service for the user.
Línea 480... Línea 480...
480
    }
480
    }
Línea 481... Línea 481...
481
 
481
 
482
    /**
482
    /**
483
     * Verify that the join sql generated by get_join_sql_by_type is valid and can be used to include favourite information.
483
     * Verify that the join sql generated by get_join_sql_by_type is valid and can be used to include favourite information.
484
     */
484
     */
485
    public function test_get_join_sql_by_type() {
485
    public function test_get_join_sql_by_type(): void {
486
        global $DB;
486
        global $DB;
Línea 487... Línea 487...
487
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
487
        list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
488
 
488