Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 129... Línea 129...
129
    /**
129
    /**
130
     * Test that a user who is enrolled in a course, but who has never
130
     * Test that a user who is enrolled in a course, but who has never
131
     * posted and has no other metadata stored will not have any link to
131
     * posted and has no other metadata stored will not have any link to
132
     * that context.
132
     * that context.
133
     */
133
     */
134
    public function test_user_has_never_posted() {
134
    public function test_user_has_never_posted(): void {
135
        // Create a course, with a forum, our user under test, another user, and a discussion + post from the other user.
135
        // Create a course, with a forum, our user under test, another user, and a discussion + post from the other user.
136
        $course = $this->getDataGenerator()->create_course();
136
        $course = $this->getDataGenerator()->create_course();
137
        $this->getDataGenerator()->create_module('forum', ['course' => $course->id]);
137
        $this->getDataGenerator()->create_module('forum', ['course' => $course->id]);
138
        $course = $this->getDataGenerator()->create_course();
138
        $course = $this->getDataGenerator()->create_course();
139
        $this->getDataGenerator()->create_module('forum', ['course' => $course->id]);
139
        $this->getDataGenerator()->create_module('forum', ['course' => $course->id]);
Línea 163... Línea 163...
163
    /**
163
    /**
164
     * Test that a user who is enrolled in a course, and who has never
164
     * Test that a user who is enrolled in a course, and who has never
165
     * posted and has subscribed to the forum will have relevant
165
     * posted and has subscribed to the forum will have relevant
166
     * information returned.
166
     * information returned.
167
     */
167
     */
168
    public function test_user_has_never_posted_subscribed_to_forum() {
168
    public function test_user_has_never_posted_subscribed_to_forum(): void {
169
        global $DB;
169
        global $DB;
Línea 170... Línea 170...
170
 
170
 
171
        // Create a course, with a forum, our user under test, another user, and a discussion + post from the other user.
171
        // Create a course, with a forum, our user under test, another user, and a discussion + post from the other user.
172
        $course = $this->getDataGenerator()->create_course();
172
        $course = $this->getDataGenerator()->create_course();
Línea 218... Línea 218...
218
    /**
218
    /**
219
     * Test that a user who is enrolled in a course, and who has never
219
     * Test that a user who is enrolled in a course, and who has never
220
     * posted and has subscribed to the discussion will have relevant
220
     * posted and has subscribed to the discussion will have relevant
221
     * information returned.
221
     * information returned.
222
     */
222
     */
223
    public function test_user_has_never_posted_subscribed_to_discussion() {
223
    public function test_user_has_never_posted_subscribed_to_discussion(): void {
224
        global $DB;
224
        global $DB;
Línea 225... Línea 225...
225
 
225
 
226
        // Create a course, with a forum, our user under test, another user, and a discussion + post from the other user.
226
        // Create a course, with a forum, our user under test, another user, and a discussion + post from the other user.
227
        $course = $this->getDataGenerator()->create_course();
227
        $course = $this->getDataGenerator()->create_course();
Línea 287... Línea 287...
287
 
287
 
288
    /**
288
    /**
289
     * Test that a user who has posted their own discussion will have all
289
     * Test that a user who has posted their own discussion will have all
290
     * content returned.
290
     * content returned.
291
     */
291
     */
292
    public function test_user_has_posted_own_discussion() {
292
    public function test_user_has_posted_own_discussion(): void {
293
        $course = $this->getDataGenerator()->create_course();
293
        $course = $this->getDataGenerator()->create_course();
294
        $this->getDataGenerator()->create_module('forum', ['course' => $course->id]);
294
        $this->getDataGenerator()->create_module('forum', ['course' => $course->id]);
295
        $course = $this->getDataGenerator()->create_course();
295
        $course = $this->getDataGenerator()->create_course();
296
        $this->getDataGenerator()->create_module('forum', ['course' => $course->id]);
296
        $this->getDataGenerator()->create_module('forum', ['course' => $course->id]);
Línea 324... Línea 324...
324
 
324
 
325
    /**
325
    /**
326
     * Test that a user who has posted a reply to another users discussion will have all content returned, and
326
     * Test that a user who has posted a reply to another users discussion will have all content returned, and
327
     * appropriate content removed.
327
     * appropriate content removed.
328
     */
328
     */
329
    public function test_user_has_posted_reply() {
329
    public function test_user_has_posted_reply(): void {
Línea 330... Línea 330...
330
        global $DB;
330
        global $DB;
331
 
331
 
332
        // Create several courses and forums. We only insert data into the final one.
332
        // Create several courses and forums. We only insert data into the final one.
Línea 396... Línea 396...
396
    }
396
    }
Línea 397... Línea 397...
397
 
397
 
398
    /**
398
    /**
399
     * Test private reply in a range of scenarios.
399
     * Test private reply in a range of scenarios.
400
     */
400
     */
401
    public function test_user_private_reply() {
401
    public function test_user_private_reply(): void {
Línea 402... Línea 402...
402
        global $DB;
402
        global $DB;
403
 
403
 
404
        $course = $this->getDataGenerator()->create_course();
404
        $course = $this->getDataGenerator()->create_course();
Línea 484... Línea 484...
484
 
484
 
485
    /**
485
    /**
486
     * Test that the rating of another users content will have only the
486
     * Test that the rating of another users content will have only the
487
     * rater's information returned.
487
     * rater's information returned.
488
     */
488
     */
489
    public function test_user_has_rated_others() {
489
    public function test_user_has_rated_others(): void {
Línea 490... Línea 490...
490
        global $DB;
490
        global $DB;
491
 
491
 
492
        $course = $this->getDataGenerator()->create_course();
492
        $course = $this->getDataGenerator()->create_course();
Línea 554... Línea 554...
554
    }
554
    }
Línea 555... Línea 555...
555
 
555
 
556
    /**
556
    /**
557
     * Test that ratings of a users own content will all be returned.
557
     * Test that ratings of a users own content will all be returned.
558
     */
558
     */
559
    public function test_user_has_been_rated() {
559
    public function test_user_has_been_rated(): void {
Línea 560... Línea 560...
560
        global $DB;
560
        global $DB;
561
 
561
 
562
        $course = $this->getDataGenerator()->create_course();
562
        $course = $this->getDataGenerator()->create_course();
Línea 621... Línea 621...
621
    }
621
    }
Línea 622... Línea 622...
622
 
622
 
623
    /**
623
    /**
624
     * Test that per-user daily digest settings are included correctly.
624
     * Test that per-user daily digest settings are included correctly.
625
     */
625
     */
626
    public function test_user_forum_digest() {
626
    public function test_user_forum_digest(): void {
Línea 627... Línea 627...
627
        global $DB;
627
        global $DB;
Línea 628... Línea 628...
628
 
628
 
Línea 696... Línea 696...
696
    }
696
    }
Línea 697... Línea 697...
697
 
697
 
698
    /**
698
    /**
699
     * Test that the per-user, per-forum user tracking data is exported.
699
     * Test that the per-user, per-forum user tracking data is exported.
700
     */
700
     */
701
    public function test_user_tracking_data() {
701
    public function test_user_tracking_data(): void {
Línea 702... Línea 702...
702
        global $DB;
702
        global $DB;
Línea 703... Línea 703...
703
 
703
 
Línea 759... Línea 759...
759
    }
759
    }
Línea 760... Línea 760...
760
 
760
 
761
    /**
761
    /**
762
     * Test that the posts which a user has read are returned correctly.
762
     * Test that the posts which a user has read are returned correctly.
763
     */
763
     */
764
    public function test_user_read_posts() {
764
    public function test_user_read_posts(): void {
Línea 765... Línea 765...
765
        global $DB;
765
        global $DB;
Línea 766... Línea 766...
766
 
766
 
Línea 936... Línea 936...
936
    }
936
    }
Línea 937... Línea 937...
937
 
937
 
938
    /**
938
    /**
939
     * Test that posts with attachments have their attachments correctly exported.
939
     * Test that posts with attachments have their attachments correctly exported.
940
     */
940
     */
941
    public function test_post_attachment_inclusion() {
941
    public function test_post_attachment_inclusion(): void {
Línea 942... Línea 942...
942
        global $DB;
942
        global $DB;
943
 
943
 
944
        $fs = get_file_storage();
944
        $fs = get_file_storage();
Línea 1003... Línea 1003...
1003
    }
1003
    }
Línea 1004... Línea 1004...
1004
 
1004
 
1005
    /**
1005
    /**
1006
     * Test that posts which include tags have those tags exported.
1006
     * Test that posts which include tags have those tags exported.
1007
     */
1007
     */
1008
    public function test_post_tags() {
1008
    public function test_post_tags(): void {
Línea 1009... Línea 1009...
1009
        global $DB;
1009
        global $DB;
1010
 
1010
 
Línea 1061... Línea 1061...
1061
    }
1061
    }
Línea 1062... Línea 1062...
1062
 
1062
 
1063
    /**
1063
    /**
1064
     * Ensure that all user data is deleted from a context.
1064
     * Ensure that all user data is deleted from a context.
1065
     */
1065
     */
1066
    public function test_all_users_deleted_from_context() {
1066
    public function test_all_users_deleted_from_context(): void {
Línea 1067... Línea 1067...
1067
        global $DB;
1067
        global $DB;
1068
 
1068
 
1069
        $fs = get_file_storage();
1069
        $fs = get_file_storage();
Línea 1266... Línea 1266...
1266
    }
1266
    }
Línea 1267... Línea 1267...
1267
 
1267
 
1268
    /**
1268
    /**
1269
     * Ensure that all user data is deleted for a specific context.
1269
     * Ensure that all user data is deleted for a specific context.
1270
     */
1270
     */
1271
    public function test_delete_data_for_user() {
1271
    public function test_delete_data_for_user(): void {
Línea 1272... Línea 1272...
1272
        global $DB;
1272
        global $DB;
1273
 
1273
 
1274
        $fs = get_file_storage();
1274
        $fs = get_file_storage();
Línea 1481... Línea 1481...
1481
    }
1481
    }
Línea 1482... Línea 1482...
1482
 
1482
 
1483
    /**
1483
    /**
1484
     * Ensure that user data for specific users is deleted from a specified context.
1484
     * Ensure that user data for specific users is deleted from a specified context.
1485
     */
1485
     */
1486
    public function test_delete_data_for_users() {
1486
    public function test_delete_data_for_users(): void {
Línea 1487... Línea 1487...
1487
        global $DB;
1487
        global $DB;
1488
 
1488
 
1489
        $fs = get_file_storage();
1489
        $fs = get_file_storage();
Línea 1693... Línea 1693...
1693
    }
1693
    }
Línea 1694... Línea 1694...
1694
 
1694
 
1695
    /**
1695
    /**
1696
     * Ensure that the discussion author is listed as a user in the context.
1696
     * Ensure that the discussion author is listed as a user in the context.
1697
     */
1697
     */
1698
    public function test_get_users_in_context_post_author() {
1698
    public function test_get_users_in_context_post_author(): void {
1699
        global $DB;
1699
        global $DB;
Línea 1700... Línea 1700...
1700
        $component = 'mod_forum';
1700
        $component = 'mod_forum';
Línea 1718... Línea 1718...
1718
    }
1718
    }
Línea 1719... Línea 1719...
1719
 
1719
 
1720
    /**
1720
    /**
1721
     * Ensure that all post authors are included as a user in the context.
1721
     * Ensure that all post authors are included as a user in the context.
1722
     */
1722
     */
1723
    public function test_get_users_in_context_post_authors() {
1723
    public function test_get_users_in_context_post_authors(): void {
1724
        global $DB;
1724
        global $DB;
Línea 1725... Línea 1725...
1725
        $component = 'mod_forum';
1725
        $component = 'mod_forum';
Línea 1752... Línea 1752...
1752
    }
1752
    }
Línea 1753... Línea 1753...
1753
 
1753
 
1754
    /**
1754
    /**
1755
     * Ensure that all post raters are included as a user in the context.
1755
     * Ensure that all post raters are included as a user in the context.
1756
     */
1756
     */
1757
    public function test_get_users_in_context_post_ratings() {
1757
    public function test_get_users_in_context_post_ratings(): void {
1758
        global $DB;
1758
        global $DB;
Línea 1759... Línea 1759...
1759
        $component = 'mod_forum';
1759
        $component = 'mod_forum';
Línea 1801... Línea 1801...
1801
    }
1801
    }
Línea 1802... Línea 1802...
1802
 
1802
 
1803
    /**
1803
    /**
1804
     * Ensure that all users with a digest preference are included as a user in the context.
1804
     * Ensure that all users with a digest preference are included as a user in the context.
1805
     */
1805
     */
1806
    public function test_get_users_in_context_digest_preference() {
1806
    public function test_get_users_in_context_digest_preference(): void {
1807
        global $DB;
1807
        global $DB;
Línea 1808... Línea 1808...
1808
        $component = 'mod_forum';
1808
        $component = 'mod_forum';
Línea 1839... Línea 1839...
1839
    }
1839
    }
Línea 1840... Línea 1840...
1840
 
1840
 
1841
    /**
1841
    /**
1842
     * Ensure that all users with a forum subscription preference included as a user in the context.
1842
     * Ensure that all users with a forum subscription preference included as a user in the context.
1843
     */
1843
     */
1844
    public function test_get_users_in_context_with_subscription() {
1844
    public function test_get_users_in_context_with_subscription(): void {
1845
        global $DB;
1845
        global $DB;
Línea 1846... Línea 1846...
1846
        $component = 'mod_forum';
1846
        $component = 'mod_forum';
Línea 1876... Línea 1876...
1876
    }
1876
    }
Línea 1877... Línea 1877...
1877
 
1877
 
1878
    /**
1878
    /**
1879
     * Ensure that all users with a per-discussion subscription preference included as a user in the context.
1879
     * Ensure that all users with a per-discussion subscription preference included as a user in the context.
1880
     */
1880
     */
1881
    public function test_get_users_in_context_with_discussion_subscription() {
1881
    public function test_get_users_in_context_with_discussion_subscription(): void {
1882
        global $DB;
1882
        global $DB;
Línea 1883... Línea 1883...
1883
        $component = 'mod_forum';
1883
        $component = 'mod_forum';
Línea 1918... Línea 1918...
1918
    }
1918
    }
Línea 1919... Línea 1919...
1919
 
1919
 
1920
    /**
1920
    /**
1921
     * Ensure that all users with read tracking are included as a user in the context.
1921
     * Ensure that all users with read tracking are included as a user in the context.
1922
     */
1922
     */
1923
    public function test_get_users_in_context_with_read_post_tracking() {
1923
    public function test_get_users_in_context_with_read_post_tracking(): void {
1924
        global $DB;
1924
        global $DB;
Línea 1925... Línea 1925...
1925
        $component = 'mod_forum';
1925
        $component = 'mod_forum';
Línea 1960... Línea 1960...
1960
    }
1960
    }
Línea 1961... Línea 1961...
1961
 
1961
 
1962
    /**
1962
    /**
1963
     * Ensure that all users with tracking preferences are included as a user in the context.
1963
     * Ensure that all users with tracking preferences are included as a user in the context.
1964
     */
1964
     */
1965
    public function test_get_users_in_context_with_tracking_preferences() {
1965
    public function test_get_users_in_context_with_tracking_preferences(): void {
1966
        global $DB;
1966
        global $DB;
Línea 1967... Línea 1967...
1967
        $component = 'mod_forum';
1967
        $component = 'mod_forum';