Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 61... Línea 61...
61
    /**
61
    /**
62
     * Test subscription modes modifications.
62
     * Test subscription modes modifications.
63
     *
63
     *
64
     * @covers \mod_forum\event\subscription_mode_updated
64
     * @covers \mod_forum\event\subscription_mode_updated
65
     */
65
     */
66
    public function test_subscription_modes() {
66
    public function test_subscription_modes(): void {
67
        global $DB;
67
        global $DB;
Línea 68... Línea 68...
68
 
68
 
Línea 69... Línea 69...
69
        $this->resetAfterTest(true);
69
        $this->resetAfterTest(true);
Línea 147... Línea 147...
147
    }
147
    }
Línea 148... Línea 148...
148
 
148
 
149
    /**
149
    /**
150
     * Test fetching unsubscribable forums.
150
     * Test fetching unsubscribable forums.
151
     */
151
     */
152
    public function test_unsubscribable_forums() {
152
    public function test_unsubscribable_forums(): void {
Línea 153... Línea 153...
153
        global $DB;
153
        global $DB;
Línea 154... Línea 154...
154
 
154
 
Línea 208... Línea 208...
208
 
208
 
209
    /**
209
    /**
210
     * Test that toggling the forum-level subscription for a different user does not affect their discussion-level
210
     * Test that toggling the forum-level subscription for a different user does not affect their discussion-level
211
     * subscriptions.
211
     * subscriptions.
212
     */
212
     */
213
    public function test_forum_subscribe_toggle_as_other() {
213
    public function test_forum_subscribe_toggle_as_other(): void {
Línea 214... Línea 214...
214
        global $DB;
214
        global $DB;
Línea 215... Línea 215...
215
 
215
 
Línea 397... Línea 397...
397
    }
397
    }
Línea 398... Línea 398...
398
 
398
 
399
    /**
399
    /**
400
     * Test that a user unsubscribed from a forum is not subscribed to it's discussions by default.
400
     * Test that a user unsubscribed from a forum is not subscribed to it's discussions by default.
401
     */
401
     */
402
    public function test_forum_discussion_subscription_forum_unsubscribed() {
402
    public function test_forum_discussion_subscription_forum_unsubscribed(): void {
Línea 403... Línea 403...
403
        $this->resetAfterTest(true);
403
        $this->resetAfterTest(true);
404
 
404
 
Línea 422... Línea 422...
422
    }
422
    }
Línea 423... Línea 423...
423
 
423
 
424
    /**
424
    /**
425
     * Test that the act of subscribing to a forum subscribes the user to it's discussions by default.
425
     * Test that the act of subscribing to a forum subscribes the user to it's discussions by default.
426
     */
426
     */
427
    public function test_forum_discussion_subscription_forum_subscribed() {
427
    public function test_forum_discussion_subscription_forum_subscribed(): void {
Línea 428... Línea 428...
428
        $this->resetAfterTest(true);
428
        $this->resetAfterTest(true);
429
 
429
 
Línea 454... Línea 454...
454
    }
454
    }
Línea 455... Línea 455...
455
 
455
 
456
    /**
456
    /**
457
     * Test that a user unsubscribed from a forum can be subscribed to a discussion.
457
     * Test that a user unsubscribed from a forum can be subscribed to a discussion.
458
     */
458
     */
459
    public function test_forum_discussion_subscription_forum_unsubscribed_discussion_subscribed() {
459
    public function test_forum_discussion_subscription_forum_unsubscribed_discussion_subscribed(): void {
Línea 460... Línea 460...
460
        $this->resetAfterTest(true);
460
        $this->resetAfterTest(true);
461
 
461
 
Línea 488... Línea 488...
488
    }
488
    }
Línea 489... Línea 489...
489
 
489
 
490
    /**
490
    /**
491
     * Test that a user subscribed to a forum can be unsubscribed from a discussion.
491
     * Test that a user subscribed to a forum can be unsubscribed from a discussion.
492
     */
492
     */
493
    public function test_forum_discussion_subscription_forum_subscribed_discussion_unsubscribed() {
493
    public function test_forum_discussion_subscription_forum_subscribed_discussion_unsubscribed(): void {
Línea 494... Línea 494...
494
        $this->resetAfterTest(true);
494
        $this->resetAfterTest(true);
495
 
495
 
Línea 522... Línea 522...
522
    }
522
    }
Línea 523... Línea 523...
523
 
523
 
524
    /**
524
    /**
525
     * Test the effect of toggling the discussion subscription status when subscribed to the forum.
525
     * Test the effect of toggling the discussion subscription status when subscribed to the forum.
526
     */
526
     */
527
    public function test_forum_discussion_toggle_forum_subscribed() {
527
    public function test_forum_discussion_toggle_forum_subscribed(): void {
Línea 528... Línea 528...
528
        global $DB;
528
        global $DB;
Línea 529... Línea 529...
529
 
529
 
Línea 702... Línea 702...
702
    }
702
    }
Línea 703... Línea 703...
703
 
703
 
704
    /**
704
    /**
705
     * Test the effect of toggling the discussion subscription status when unsubscribed from the forum.
705
     * Test the effect of toggling the discussion subscription status when unsubscribed from the forum.
706
     */
706
     */
707
    public function test_forum_discussion_toggle_forum_unsubscribed() {
707
    public function test_forum_discussion_toggle_forum_unsubscribed(): void {
Línea 708... Línea 708...
708
        global $DB;
708
        global $DB;
Línea 709... Línea 709...
709
 
709
 
Línea 793... Línea 793...
793
 
793
 
794
    /**
794
    /**
795
     * Test that the correct users are returned when fetching subscribed users from a forum where users can choose to
795
     * Test that the correct users are returned when fetching subscribed users from a forum where users can choose to
796
     * subscribe and unsubscribe.
796
     * subscribe and unsubscribe.
797
     */
797
     */
798
    public function test_fetch_subscribed_users_subscriptions() {
798
    public function test_fetch_subscribed_users_subscriptions(): void {
Línea 799... Línea 799...
799
        global $DB, $CFG;
799
        global $DB, $CFG;
Línea 800... Línea 800...
800
 
800
 
Línea 831... Línea 831...
831
 
831
 
832
    /**
832
    /**
833
     * Test that the correct users are returned hwen fetching subscribed users from a forum where users are forcibly
833
     * Test that the correct users are returned hwen fetching subscribed users from a forum where users are forcibly
834
     * subscribed.
834
     * subscribed.
835
     */
835
     */
836
    public function test_fetch_subscribed_users_forced() {
836
    public function test_fetch_subscribed_users_forced(): void {
Línea 837... Línea 837...
837
        global $DB;
837
        global $DB;
Línea 838... Línea 838...
838
 
838
 
Línea 853... Línea 853...
853
    }
853
    }
Línea 854... Línea 854...
854
 
854
 
855
    /**
855
    /**
856
     * Test that unusual combinations of discussion subscriptions do not affect the subscribed user list.
856
     * Test that unusual combinations of discussion subscriptions do not affect the subscribed user list.
857
     */
857
     */
858
    public function test_fetch_subscribed_users_discussion_subscriptions() {
858
    public function test_fetch_subscribed_users_discussion_subscriptions(): void {
Línea 859... Línea 859...
859
        global $DB;
859
        global $DB;
Línea 860... Línea 860...
860
 
860
 
Línea 925... Línea 925...
925
    }
925
    }
Línea 926... Línea 926...
926
 
926
 
927
    /**
927
    /**
928
     * Test whether a user is force-subscribed to a forum.
928
     * Test whether a user is force-subscribed to a forum.
929
     */
929
     */
930
    public function test_force_subscribed_to_forum() {
930
    public function test_force_subscribed_to_forum(): void {
Línea 931... Línea 931...
931
        global $DB;
931
        global $DB;
Línea 932... Línea 932...
932
 
932
 
Línea 957... Línea 957...
957
    }
957
    }
Línea 958... Línea 958...
958
 
958
 
959
    /**
959
    /**
960
     * Test that the subscription cache can be pre-filled.
960
     * Test that the subscription cache can be pre-filled.
961
     */
961
     */
962
    public function test_subscription_cache_prefill() {
962
    public function test_subscription_cache_prefill(): void {
Línea 963... Línea 963...
963
        global $DB;
963
        global $DB;
Línea 964... Línea 964...
964
 
964
 
Línea 992... Línea 992...
992
    }
992
    }
Línea 993... Línea 993...
993
 
993
 
994
    /**
994
    /**
995
     * Test that the subscription cache can filled user-at-a-time.
995
     * Test that the subscription cache can filled user-at-a-time.
996
     */
996
     */
997
    public function test_subscription_cache_fill() {
997
    public function test_subscription_cache_fill(): void {
Línea 998... Línea 998...
998
        global $DB;
998
        global $DB;
Línea 999... Línea 999...
999
 
999
 
Línea 1023... Línea 1023...
1023
    }
1023
    }
Línea 1024... Línea 1024...
1024
 
1024
 
1025
    /**
1025
    /**
1026
     * Test that the discussion subscription cache can filled course-at-a-time.
1026
     * Test that the discussion subscription cache can filled course-at-a-time.
1027
     */
1027
     */
1028
    public function test_discussion_subscription_cache_fill_for_course() {
1028
    public function test_discussion_subscription_cache_fill_for_course(): void {
Línea 1029... Línea 1029...
1029
        global $DB;
1029
        global $DB;
Línea 1030... Línea 1030...
1030
 
1030
 
Línea 1071... Línea 1071...
1071
    }
1071
    }
Línea 1072... Línea 1072...
1072
 
1072
 
1073
    /**
1073
    /**
1074
     * Test that the discussion subscription cache can be forcibly updated for a user.
1074
     * Test that the discussion subscription cache can be forcibly updated for a user.
1075
     */
1075
     */
1076
    public function test_discussion_subscription_cache_prefill() {
1076
    public function test_discussion_subscription_cache_prefill(): void {
Línea 1077... Línea 1077...
1077
        global $DB;
1077
        global $DB;
Línea 1078... Línea 1078...
1078
 
1078
 
Línea 1159... Línea 1159...
1159
    }
1159
    }
Línea 1160... Línea 1160...
1160
 
1160
 
1161
    /**
1161
    /**
1162
     * Test that the discussion subscription cache can filled user-at-a-time.
1162
     * Test that the discussion subscription cache can filled user-at-a-time.
1163
     */
1163
     */
1164
    public function test_discussion_subscription_cache_fill() {
1164
    public function test_discussion_subscription_cache_fill(): void {
Línea 1165... Línea 1165...
1165
        global $DB;
1165
        global $DB;
Línea 1166... Línea 1166...
1166
 
1166
 
Línea 1218... Línea 1218...
1218
 
1218
 
1219
    /**
1219
    /**
1220
     * Test that after toggling the forum subscription as another user,
1220
     * Test that after toggling the forum subscription as another user,
1221
     * the discussion subscription functionality works as expected.
1221
     * the discussion subscription functionality works as expected.
1222
     */
1222
     */
1223
    public function test_forum_subscribe_toggle_as_other_repeat_subscriptions() {
1223
    public function test_forum_subscribe_toggle_as_other_repeat_subscriptions(): void {
Línea 1224... Línea 1224...
1224
        global $DB;
1224
        global $DB;
Línea 1225... Línea 1225...
1225
 
1225
 
Línea 1306... Línea 1306...
1306
 
1306
 
1307
    /**
1307
    /**
1308
     * Test that providing a context_module instance to is_subscribed does not result in additional lookups to retrieve
1308
     * Test that providing a context_module instance to is_subscribed does not result in additional lookups to retrieve
1309
     * the context_module.
1309
     * the context_module.
1310
     */
1310
     */
1311
    public function test_is_subscribed_cm() {
1311
    public function test_is_subscribed_cm(): void {
Línea 1312... Línea 1312...
1312
        global $DB;
1312
        global $DB;
Línea 1313... Línea 1313...
1313
 
1313
 
Línea 1380... Línea 1380...
1380
    }
1380
    }
Línea 1381... Línea 1381...
1381
 
1381
 
1382
    /**
1382
    /**
1383
     * @dataProvider is_subscribable_provider
1383
     * @dataProvider is_subscribable_provider
1384
     */
1384
     */
1385
    public function test_is_subscribable_logged_out($options) {
1385
    public function test_is_subscribable_logged_out($options): void {
Línea 1386... Línea 1386...
1386
        $this->resetAfterTest(true);
1386
        $this->resetAfterTest(true);
1387
 
1387
 
1388
        // Create a course, with a forum.
1388
        // Create a course, with a forum.
Línea 1394... Línea 1394...
1394
    }
1394
    }
Línea 1395... Línea 1395...
1395
 
1395
 
1396
    /**
1396
    /**
1397
     * @dataProvider is_subscribable_provider
1397
     * @dataProvider is_subscribable_provider
1398
     */
1398
     */
1399
    public function test_is_subscribable_is_guest($options) {
1399
    public function test_is_subscribable_is_guest($options): void {
1400
        global $DB;
1400
        global $DB;
Línea 1401... Línea 1401...
1401
        $this->resetAfterTest(true);
1401
        $this->resetAfterTest(true);
1402
 
1402
 
Línea 1433... Línea 1433...
1433
    }
1433
    }
Línea 1434... Línea 1434...
1434
 
1434
 
1435
    /**
1435
    /**
1436
     * @dataProvider is_subscribable_loggedin_provider
1436
     * @dataProvider is_subscribable_loggedin_provider
1437
     */
1437
     */
1438
    public function test_is_subscribable_loggedin($options, $expect) {
1438
    public function test_is_subscribable_loggedin($options, $expect): void {
Línea 1439... Línea 1439...
1439
        $this->resetAfterTest(true);
1439
        $this->resetAfterTest(true);
1440
 
1440
 
1441
        // Create a course, with a forum.
1441
        // Create a course, with a forum.
Línea 1448... Línea 1448...
1448
        $this->setUser($user);
1448
        $this->setUser($user);
Línea 1449... Línea 1449...
1449
 
1449
 
1450
        $this->assertEquals($expect, \mod_forum\subscriptions::is_subscribable($forum));
1450
        $this->assertEquals($expect, \mod_forum\subscriptions::is_subscribable($forum));
Línea 1451... Línea 1451...
1451
    }
1451
    }
1452
 
1452
 
1453
    public function test_get_user_default_subscription() {
1453
    public function test_get_user_default_subscription(): void {
Línea 1454... Línea 1454...
1454
        global $DB;
1454
        global $DB;
1455
        $this->resetAfterTest(true);
1455
        $this->resetAfterTest(true);