Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 53... Línea 53...
53
    }
53
    }
Línea 54... Línea 54...
54
 
54
 
55
    /**
55
    /**
56
     * Test get_from_id.
56
     * Test get_from_id.
57
     */
57
     */
58
    public function test_get_from_id() {
58
    public function test_get_from_id(): void {
Línea 59... Línea 59...
59
        $this->resetAfterTest();
59
        $this->resetAfterTest();
60
 
60
 
61
        $datagenerator = $this->getDataGenerator();
61
        $datagenerator = $this->getDataGenerator();
Línea 72... Línea 72...
72
    /**
72
    /**
73
     * Test get_from_discussion_id.
73
     * Test get_from_discussion_id.
74
     *
74
     *
75
     * @covers ::get_from_discussion_id
75
     * @covers ::get_from_discussion_id
76
     */
76
     */
77
    public function test_get_from_discussion_id() {
77
    public function test_get_from_discussion_id(): void {
78
        $this->resetAfterTest();
78
        $this->resetAfterTest();
Línea 79... Línea 79...
79
 
79
 
80
        $datagenerator = $this->getDataGenerator();
80
        $datagenerator = $this->getDataGenerator();
81
        $user = $datagenerator->create_user();
81
        $user = $datagenerator->create_user();
Línea 101... Línea 101...
101
     * Ensure that selecting posts in a discussion only returns posts that the user can see, when considering private
101
     * Ensure that selecting posts in a discussion only returns posts that the user can see, when considering private
102
     * replies.
102
     * replies.
103
     *
103
     *
104
     * @covers ::get_from_discussion_id
104
     * @covers ::get_from_discussion_id
105
     */
105
     */
106
    public function test_get_from_discussion_id_private_replies() {
106
    public function test_get_from_discussion_id_private_replies(): void {
107
        $this->resetAfterTest();
107
        $this->resetAfterTest();
Línea 108... Línea 108...
108
 
108
 
109
        $course = $this->getDataGenerator()->create_course();
109
        $course = $this->getDataGenerator()->create_course();
110
        $forum = $this->getDataGenerator()->create_module('forum', [
110
        $forum = $this->getDataGenerator()->create_module('forum', [
Línea 145... Línea 145...
145
    /**
145
    /**
146
     * Test get_from_discussion_ids when no discussion ids were provided.
146
     * Test get_from_discussion_ids when no discussion ids were provided.
147
     *
147
     *
148
     * @covers ::get_from_discussion_ids
148
     * @covers ::get_from_discussion_ids
149
     */
149
     */
150
    public function test_get_from_discussion_ids_empty() {
150
    public function test_get_from_discussion_ids_empty(): void {
151
        $this->resetAfterTest();
151
        $this->resetAfterTest();
Línea 152... Línea 152...
152
 
152
 
153
        $datagenerator = $this->getDataGenerator();
153
        $datagenerator = $this->getDataGenerator();
154
        $user = $datagenerator->create_user();
154
        $user = $datagenerator->create_user();
Línea 161... Línea 161...
161
    /**
161
    /**
162
     * Test get_from_discussion_ids.
162
     * Test get_from_discussion_ids.
163
     *
163
     *
164
     * @covers ::get_from_discussion_ids
164
     * @covers ::get_from_discussion_ids
165
     */
165
     */
166
    public function test_get_from_discussion_ids() {
166
    public function test_get_from_discussion_ids(): void {
167
        $this->resetAfterTest();
167
        $this->resetAfterTest();
Línea 168... Línea 168...
168
 
168
 
169
        $datagenerator = $this->getDataGenerator();
169
        $datagenerator = $this->getDataGenerator();
170
        $user = $datagenerator->create_user();
170
        $user = $datagenerator->create_user();
Línea 207... Línea 207...
207
     * Ensure that selecting posts in a discussion only returns posts that the user can see, when considering private
207
     * Ensure that selecting posts in a discussion only returns posts that the user can see, when considering private
208
     * replies.
208
     * replies.
209
     *
209
     *
210
     * @covers ::get_from_discussion_ids
210
     * @covers ::get_from_discussion_ids
211
     */
211
     */
212
    public function test_get_from_discussion_ids_private_replies() {
212
    public function test_get_from_discussion_ids_private_replies(): void {
213
        $this->resetAfterTest();
213
        $this->resetAfterTest();
Línea 214... Línea 214...
214
 
214
 
215
        $course = $this->getDataGenerator()->create_course();
215
        $course = $this->getDataGenerator()->create_course();
216
        $forum = $this->getDataGenerator()->create_module('forum', [
216
        $forum = $this->getDataGenerator()->create_module('forum', [
Línea 303... Línea 303...
303
    /**
303
    /**
304
     * Test get_replies_to_post.
304
     * Test get_replies_to_post.
305
     *
305
     *
306
     * @covers ::get_replies_to_post
306
     * @covers ::get_replies_to_post
307
     */
307
     */
308
    public function test_get_replies_to_post() {
308
    public function test_get_replies_to_post(): void {
309
        $this->resetAfterTest();
309
        $this->resetAfterTest();
Línea 310... Línea 310...
310
 
310
 
311
        $datagenerator = $this->getDataGenerator();
311
        $datagenerator = $this->getDataGenerator();
312
        $forumgenerator = $datagenerator->get_plugin_generator('mod_forum');
312
        $forumgenerator = $datagenerator->get_plugin_generator('mod_forum');
Línea 351... Línea 351...
351
    /**
351
    /**
352
     * Test get_replies_to_post with private replies.
352
     * Test get_replies_to_post with private replies.
353
     *
353
     *
354
     * @covers ::get_replies_to_post
354
     * @covers ::get_replies_to_post
355
     */
355
     */
356
    public function test_get_replies_to_post_private_replies() {
356
    public function test_get_replies_to_post_private_replies(): void {
357
        $this->resetAfterTest();
357
        $this->resetAfterTest();
Línea 358... Línea 358...
358
 
358
 
359
        $course = $this->getDataGenerator()->create_course();
359
        $course = $this->getDataGenerator()->create_course();
360
        $forum = $this->getDataGenerator()->create_module('forum', [
360
        $forum = $this->getDataGenerator()->create_module('forum', [
Línea 511... Línea 511...
511
    /**
511
    /**
512
     * Test get_reply_count_for_discussion_ids when no discussion ids were provided.
512
     * Test get_reply_count_for_discussion_ids when no discussion ids were provided.
513
     *
513
     *
514
     * @covers ::get_reply_count_for_discussion_ids
514
     * @covers ::get_reply_count_for_discussion_ids
515
     */
515
     */
516
    public function test_get_reply_count_for_discussion_ids_empty() {
516
    public function test_get_reply_count_for_discussion_ids_empty(): void {
517
        $this->resetAfterTest();
517
        $this->resetAfterTest();
Línea 518... Línea 518...
518
 
518
 
519
        $datagenerator = $this->getDataGenerator();
519
        $datagenerator = $this->getDataGenerator();
520
        $user = $datagenerator->create_user();
520
        $user = $datagenerator->create_user();
Línea 527... Línea 527...
527
    /**
527
    /**
528
     * Test get_reply_count_for_discussion_ids.
528
     * Test get_reply_count_for_discussion_ids.
529
     *
529
     *
530
     * @covers ::get_reply_count_for_discussion_ids
530
     * @covers ::get_reply_count_for_discussion_ids
531
     */
531
     */
532
    public function test_get_reply_count_for_discussion_ids() {
532
    public function test_get_reply_count_for_discussion_ids(): void {
533
        $this->resetAfterTest();
533
        $this->resetAfterTest();
Línea 534... Línea 534...
534
 
534
 
535
        $datagenerator = $this->getDataGenerator();
535
        $datagenerator = $this->getDataGenerator();
536
        $user = $datagenerator->create_user();
536
        $user = $datagenerator->create_user();
Línea 576... Línea 576...
576
    /**
576
    /**
577
     * Test get_reply_count_for_discussion_ids.
577
     * Test get_reply_count_for_discussion_ids.
578
     *
578
     *
579
     * @covers ::get_reply_count_for_discussion_ids
579
     * @covers ::get_reply_count_for_discussion_ids
580
     */
580
     */
581
    public function test_get_reply_count_for_discussion_ids_private_replies() {
581
    public function test_get_reply_count_for_discussion_ids_private_replies(): void {
582
        $this->resetAfterTest();
582
        $this->resetAfterTest();
Línea 583... Línea 583...
583
 
583
 
584
        $course = $this->getDataGenerator()->create_course();
584
        $course = $this->getDataGenerator()->create_course();
585
        $forum = $this->getDataGenerator()->create_module('forum', [
585
        $forum = $this->getDataGenerator()->create_module('forum', [
Línea 626... Línea 626...
626
    /**
626
    /**
627
     * Test get_reply_count_for_discussion_id.
627
     * Test get_reply_count_for_discussion_id.
628
     *
628
     *
629
     * @covers ::get_reply_count_for_post_id_in_discussion_id
629
     * @covers ::get_reply_count_for_post_id_in_discussion_id
630
     */
630
     */
631
    public function test_get_reply_count_for_post_id_in_discussion_id() {
631
    public function test_get_reply_count_for_post_id_in_discussion_id(): void {
632
        $this->resetAfterTest();
632
        $this->resetAfterTest();
Línea 633... Línea 633...
633
 
633
 
634
        $datagenerator = $this->getDataGenerator();
634
        $datagenerator = $this->getDataGenerator();
635
        $user = $datagenerator->create_user();
635
        $user = $datagenerator->create_user();
Línea 656... Línea 656...
656
    /**
656
    /**
657
     * Test get_reply_count_for_post_id_in_discussion_id.
657
     * Test get_reply_count_for_post_id_in_discussion_id.
658
     *
658
     *
659
     * @covers ::get_reply_count_for_post_id_in_discussion_id
659
     * @covers ::get_reply_count_for_post_id_in_discussion_id
660
     */
660
     */
661
    public function test_get_reply_count_for_post_id_in_discussion_id_private_replies() {
661
    public function test_get_reply_count_for_post_id_in_discussion_id_private_replies(): void {
662
        $this->resetAfterTest();
662
        $this->resetAfterTest();
Línea 663... Línea 663...
663
 
663
 
664
        $course = $this->getDataGenerator()->create_course();
664
        $course = $this->getDataGenerator()->create_course();
665
        $forum = $this->getDataGenerator()->create_module('forum', [
665
        $forum = $this->getDataGenerator()->create_module('forum', [
Línea 706... Línea 706...
706
    /**
706
    /**
707
     * Test get_unread_count_for_discussion_ids.
707
     * Test get_unread_count_for_discussion_ids.
708
     *
708
     *
709
     * @covers ::get_unread_count_for_discussion_ids
709
     * @covers ::get_unread_count_for_discussion_ids
710
     */
710
     */
711
    public function test_get_unread_count_for_discussion_ids() {
711
    public function test_get_unread_count_for_discussion_ids(): void {
712
        global $CFG;
712
        global $CFG;
713
        $this->resetAfterTest();
713
        $this->resetAfterTest();
Línea 714... Línea 714...
714
 
714
 
715
        $datagenerator = $this->getDataGenerator();
715
        $datagenerator = $this->getDataGenerator();
Línea 766... Línea 766...
766
    /**
766
    /**
767
     * Test get_unread_count_for_discussion_ids when no discussion ids were provided.
767
     * Test get_unread_count_for_discussion_ids when no discussion ids were provided.
768
     *
768
     *
769
     * @covers ::get_unread_count_for_discussion_ids
769
     * @covers ::get_unread_count_for_discussion_ids
770
     */
770
     */
771
    public function test_get_unread_count_for_discussion_ids_empty() {
771
    public function test_get_unread_count_for_discussion_ids_empty(): void {
772
        $this->resetAfterTest();
772
        $this->resetAfterTest();
Línea 773... Línea 773...
773
 
773
 
774
        $datagenerator = $this->getDataGenerator();
774
        $datagenerator = $this->getDataGenerator();
775
        $user = $datagenerator->create_user();
775
        $user = $datagenerator->create_user();
Línea 782... Línea 782...
782
    /**
782
    /**
783
     * Test get_latest_posts_for_discussion_ids.
783
     * Test get_latest_posts_for_discussion_ids.
784
     *
784
     *
785
     * @covers ::get_latest_posts_for_discussion_ids
785
     * @covers ::get_latest_posts_for_discussion_ids
786
     */
786
     */
787
    public function test_get_latest_posts_for_discussion_ids() {
787
    public function test_get_latest_posts_for_discussion_ids(): void {
788
        $this->resetAfterTest();
788
        $this->resetAfterTest();
Línea 789... Línea 789...
789
 
789
 
790
        $datagenerator = $this->getDataGenerator();
790
        $datagenerator = $this->getDataGenerator();
791
        $course = $datagenerator->create_course();
791
        $course = $datagenerator->create_course();
Línea 844... Línea 844...
844
    /**
844
    /**
845
     * Test get_latest_posts_for_discussion_ids when no discussion ids were provided.
845
     * Test get_latest_posts_for_discussion_ids when no discussion ids were provided.
846
     *
846
     *
847
     * @covers ::get_latest_posts_for_discussion_ids
847
     * @covers ::get_latest_posts_for_discussion_ids
848
     */
848
     */
849
    public function test_get_latest_posts_for_discussion_ids_empty() {
849
    public function test_get_latest_posts_for_discussion_ids_empty(): void {
850
        $this->resetAfterTest();
850
        $this->resetAfterTest();
Línea 851... Línea 851...
851
 
851
 
852
        $datagenerator = $this->getDataGenerator();
852
        $datagenerator = $this->getDataGenerator();
853
        $user = $datagenerator->create_user();
853
        $user = $datagenerator->create_user();
Línea 860... Línea 860...
860
    /**
860
    /**
861
     * Test get_first_post_for_discussion_ids.
861
     * Test get_first_post_for_discussion_ids.
862
     *
862
     *
863
     * @covers ::get_first_post_for_discussion_ids
863
     * @covers ::get_first_post_for_discussion_ids
864
     */
864
     */
865
    public function test_get_first_post_for_discussion_ids() {
865
    public function test_get_first_post_for_discussion_ids(): void {
866
        $this->resetAfterTest();
866
        $this->resetAfterTest();
Línea 867... Línea 867...
867
 
867
 
868
        $datagenerator = $this->getDataGenerator();
868
        $datagenerator = $this->getDataGenerator();
869
        $user = $datagenerator->create_user();
869
        $user = $datagenerator->create_user();
Línea 907... Línea 907...
907
    /**
907
    /**
908
     * Test get_first_post_for_discussion_ids when no discussion ids were provided.
908
     * Test get_first_post_for_discussion_ids when no discussion ids were provided.
909
     *
909
     *
910
     * @covers ::get_first_post_for_discussion_ids
910
     * @covers ::get_first_post_for_discussion_ids
911
     */
911
     */
912
    public function test_get_first_post_for_discussion_ids_empty() {
912
    public function test_get_first_post_for_discussion_ids_empty(): void {
913
        $this->resetAfterTest();
913
        $this->resetAfterTest();
Línea 914... Línea 914...
914
 
914
 
915
        $datagenerator = $this->getDataGenerator();
915
        $datagenerator = $this->getDataGenerator();
916
        $user = $datagenerator->create_user();
916
        $user = $datagenerator->create_user();
Línea 923... Línea 923...
923
    /**
923
    /**
924
     * Test get_from_filters.
924
     * Test get_from_filters.
925
     *
925
     *
926
     * @covers ::get_from_filters
926
     * @covers ::get_from_filters
927
     */
927
     */
928
    public function test_get_from_filters() {
928
    public function test_get_from_filters(): void {
929
        $this->resetAfterTest();
929
        $this->resetAfterTest();
Línea 930... Línea 930...
930
 
930
 
931
        $datagenerator = $this->getDataGenerator();
931
        $datagenerator = $this->getDataGenerator();
932
        $course = $datagenerator->create_course();
932
        $course = $datagenerator->create_course();
Línea 984... Línea 984...
984
        $this->assertEquals($post2->id, array_values($entities)[1]->get_id());
984
        $this->assertEquals($post2->id, array_values($entities)[1]->get_id());
985
        $this->assertEquals($post3->id, array_values($entities)[2]->get_id());
985
        $this->assertEquals($post3->id, array_values($entities)[2]->get_id());
986
        $this->assertEquals($post4->id, array_values($entities)[3]->get_id());
986
        $this->assertEquals($post4->id, array_values($entities)[3]->get_id());
987
    }
987
    }
Línea 988... Línea 988...
988
 
988
 
989
    public function test_get_from_filters_from_to_dates() {
989
    public function test_get_from_filters_from_to_dates(): void {
Línea 990... Línea 990...
990
        $this->resetAfterTest();
990
        $this->resetAfterTest();
991
 
991
 
992
        $datagenerator = $this->getDataGenerator();
992
        $datagenerator = $this->getDataGenerator();
Línea 1019... Línea 1019...
1019
    /**
1019
    /**
1020
     * Test get_from_filters when no discussion ids were provided.
1020
     * Test get_from_filters when no discussion ids were provided.
1021
     *
1021
     *
1022
     * @covers ::get_from_filters
1022
     * @covers ::get_from_filters
1023
     */
1023
     */
1024
    public function test_get_from_filters_empty() {
1024
    public function test_get_from_filters_empty(): void {
1025
        $this->resetAfterTest();
1025
        $this->resetAfterTest();
Línea 1026... Línea 1026...
1026
 
1026
 
1027
        $datagenerator = $this->getDataGenerator();
1027
        $datagenerator = $this->getDataGenerator();
1028
        $course = $datagenerator->create_course();
1028
        $course = $datagenerator->create_course();
Línea 1036... Línea 1036...
1036
     * Ensure that selecting posts in a discussion only returns posts that the user can see, when considering private
1036
     * Ensure that selecting posts in a discussion only returns posts that the user can see, when considering private
1037
     * replies.
1037
     * replies.
1038
     *
1038
     *
1039
     * @covers ::get_from_filters
1039
     * @covers ::get_from_filters
1040
     */
1040
     */
1041
    public function test_get_from_filters_private_replies() {
1041
    public function test_get_from_filters_private_replies(): void {
1042
        $this->resetAfterTest();
1042
        $this->resetAfterTest();
Línea 1043... Línea 1043...
1043
 
1043
 
1044
        $course = $this->getDataGenerator()->create_course();
1044
        $course = $this->getDataGenerator()->create_course();
1045
        $forum = $this->getDataGenerator()->create_module('forum', [
1045
        $forum = $this->getDataGenerator()->create_module('forum', [