Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 102... Línea 102...
102
    }
102
    }
Línea 103... Línea 103...
103
 
103
 
104
    /**
104
    /**
105
     * Test get forums
105
     * Test get forums
106
     */
106
     */
107
    public function test_mod_forum_get_forums_by_courses() {
107
    public function test_mod_forum_get_forums_by_courses(): void {
Línea 108... Línea 108...
108
        global $USER, $CFG, $DB;
108
        global $USER, $CFG, $DB;
Línea 109... Línea 109...
109
 
109
 
Línea 233... Línea 233...
233
    }
233
    }
Línea 234... Línea 234...
234
 
234
 
235
    /**
235
    /**
236
     * Test the toggle favourite state
236
     * Test the toggle favourite state
237
     */
237
     */
238
    public function test_mod_forum_toggle_favourite_state() {
238
    public function test_mod_forum_toggle_favourite_state(): void {
Línea 239... Línea 239...
239
        global $USER, $CFG, $DB;
239
        global $USER, $CFG, $DB;
Línea 240... Línea 240...
240
 
240
 
Línea 281... Línea 281...
281
    }
281
    }
Línea 282... Línea 282...
282
 
282
 
283
    /**
283
    /**
284
     * Test the toggle pin state
284
     * Test the toggle pin state
285
     */
285
     */
286
    public function test_mod_forum_set_pin_state() {
286
    public function test_mod_forum_set_pin_state(): void {
Línea 287... Línea 287...
287
        $this->resetAfterTest(true);
287
        $this->resetAfterTest(true);
288
 
288
 
Línea 329... Línea 329...
329
    /**
329
    /**
330
     * Test get forum posts
330
     * Test get forum posts
331
     *
331
     *
332
     * Tests is similar to the get_forum_discussion_posts only utilizing the new return structure and entities
332
     * Tests is similar to the get_forum_discussion_posts only utilizing the new return structure and entities
333
     */
333
     */
334
    public function test_mod_forum_get_discussion_posts() {
334
    public function test_mod_forum_get_discussion_posts(): void {
335
        global $CFG;
335
        global $CFG;
Línea 336... Línea 336...
336
 
336
 
Línea 337... Línea 337...
337
        $this->resetAfterTest(true);
337
        $this->resetAfterTest(true);
Línea 661... Línea 661...
661
    }
661
    }
Línea 662... Línea 662...
662
 
662
 
663
    /**
663
    /**
664
     * Test get forum posts
664
     * Test get forum posts
665
     */
665
     */
666
    public function test_mod_forum_get_discussion_posts_deleted() {
666
    public function test_mod_forum_get_discussion_posts_deleted(): void {
Línea 667... Línea 667...
667
        global $CFG, $PAGE;
667
        global $CFG, $PAGE;
668
 
668
 
Línea 741... Línea 741...
741
    }
741
    }
Línea 742... Línea 742...
742
 
742
 
743
    /**
743
    /**
744
     * Test get forum posts returns inline attachments.
744
     * Test get forum posts returns inline attachments.
745
     */
745
     */
746
    public function test_mod_forum_get_discussion_posts_inline_attachments() {
746
    public function test_mod_forum_get_discussion_posts_inline_attachments(): void {
Línea 747... Línea 747...
747
        global $CFG;
747
        global $CFG;
Línea 748... Línea 748...
748
 
748
 
Línea 816... Línea 816...
816
    }
816
    }
Línea 817... Línea 817...
817
 
817
 
818
    /**
818
    /**
819
     * Test get forum posts (qanda forum)
819
     * Test get forum posts (qanda forum)
820
     */
820
     */
821
    public function test_mod_forum_get_discussion_posts_qanda() {
821
    public function test_mod_forum_get_discussion_posts_qanda(): void {
Línea 822... Línea 822...
822
        global $CFG, $DB;
822
        global $CFG, $DB;
Línea 823... Línea 823...
823
 
823
 
Línea 882... Línea 882...
882
    }
882
    }
Línea 883... Línea 883...
883
 
883
 
884
    /**
884
    /**
885
     * Test get forum discussions
885
     * Test get forum discussions
886
     */
886
     */
887
    public function test_mod_forum_get_forum_discussions() {
887
    public function test_mod_forum_get_forum_discussions(): void {
Línea 888... Línea 888...
888
        global $CFG, $DB, $PAGE;
888
        global $CFG, $DB, $PAGE;
Línea 889... Línea 889...
889
 
889
 
Línea 1049... Línea 1049...
1049
    }
1049
    }
Línea 1050... Línea 1050...
1050
 
1050
 
1051
    /**
1051
    /**
1052
     * Test the sorting in get forum discussions
1052
     * Test the sorting in get forum discussions
1053
     */
1053
     */
1054
    public function test_mod_forum_get_forum_discussions_sorting() {
1054
    public function test_mod_forum_get_forum_discussions_sorting(): void {
Línea 1055... Línea 1055...
1055
        global $CFG, $DB, $PAGE;
1055
        global $CFG, $DB, $PAGE;
Línea 1056... Línea 1056...
1056
 
1056
 
Línea 1237... Línea 1237...
1237
    }
1237
    }
Línea 1238... Línea 1238...
1238
 
1238
 
1239
    /**
1239
    /**
1240
     * Test add_discussion_post
1240
     * Test add_discussion_post
1241
     */
1241
     */
1242
    public function test_add_discussion_post() {
1242
    public function test_add_discussion_post(): void {
Línea 1243... Línea 1243...
1243
        global $CFG;
1243
        global $CFG;
Línea 1244... Línea 1244...
1244
 
1244
 
Línea 1398... Línea 1398...
1398
    }
1398
    }
Línea 1399... Línea 1399...
1399
 
1399
 
1400
    /**
1400
    /**
1401
     * Test add_discussion_post and auto subscription to a discussion.
1401
     * Test add_discussion_post and auto subscription to a discussion.
1402
     */
1402
     */
1403
    public function test_add_discussion_post_subscribe_discussion() {
1403
    public function test_add_discussion_post_subscribe_discussion(): void {
Línea 1404... Línea 1404...
1404
        global $USER;
1404
        global $USER;
Línea 1405... Línea 1405...
1405
 
1405
 
Línea 1484... Línea 1484...
1484
    }
1484
    }
Línea 1485... Línea 1485...
1485
 
1485
 
1486
    /*
1486
    /*
1487
     * Test add_discussion. A basic test since all the API functions are already covered by unit tests.
1487
     * Test add_discussion. A basic test since all the API functions are already covered by unit tests.
1488
     */
1488
     */
1489
    public function test_add_discussion() {
1489
    public function test_add_discussion(): void {
1490
        global $CFG, $USER;
1490
        global $CFG, $USER;
Línea 1491... Línea 1491...
1491
        $this->resetAfterTest(true);
1491
        $this->resetAfterTest(true);
1492
 
1492
 
Línea 1599... Línea 1599...
1599
    }
1599
    }
Línea 1600... Línea 1600...
1600
 
1600
 
1601
    /**
1601
    /**
1602
     * Test adding discussions in a course with gorups
1602
     * Test adding discussions in a course with gorups
1603
     */
1603
     */
1604
    public function test_add_discussion_in_course_with_groups() {
1604
    public function test_add_discussion_in_course_with_groups(): void {
Línea 1605... Línea 1605...
1605
        global $CFG;
1605
        global $CFG;
Línea 1606... Línea 1606...
1606
 
1606
 
Línea 1702... Línea 1702...
1702
    /*
1702
    /*
1703
     * Test set_lock_state.
1703
     * Test set_lock_state.
1704
     *
1704
     *
1705
     * @covers \mod_forum\event\discussion_lock_updated
1705
     * @covers \mod_forum\event\discussion_lock_updated
1706
     */
1706
     */
1707
    public function test_set_lock_state() {
1707
    public function test_set_lock_state(): void {
1708
        global $DB;
1708
        global $DB;
1709
        $this->resetAfterTest(true);
1709
        $this->resetAfterTest(true);
Línea 1710... Línea 1710...
1710
 
1710
 
1711
        // Create courses to add the modules.
1711
        // Create courses to add the modules.
Línea 1775... Línea 1775...
1775
    }
1775
    }
Línea 1776... Línea 1776...
1776
 
1776
 
1777
    /*
1777
    /*
1778
     * Test can_add_discussion. A basic test since all the API functions are already covered by unit tests.
1778
     * Test can_add_discussion. A basic test since all the API functions are already covered by unit tests.
1779
     */
1779
     */
1780
    public function test_can_add_discussion() {
1780
    public function test_can_add_discussion(): void {
1781
        global $DB;
1781
        global $DB;
Línea 1782... Línea 1782...
1782
        $this->resetAfterTest(true);
1782
        $this->resetAfterTest(true);
1783
 
1783
 
Línea 1820... Línea 1820...
1820
    }
1820
    }
Línea 1821... Línea 1821...
1821
 
1821
 
1822
    /*
1822
    /*
1823
     * A basic test to make sure users cannot post to forum after the cutoff date.
1823
     * A basic test to make sure users cannot post to forum after the cutoff date.
1824
     */
1824
     */
1825
    public function test_can_add_discussion_after_cutoff() {
1825
    public function test_can_add_discussion_after_cutoff(): void {
Línea 1826... Línea 1826...
1826
        $this->resetAfterTest(true);
1826
        $this->resetAfterTest(true);
1827
 
1827
 
Línea 1848... Línea 1848...
1848
    }
1848
    }
Línea 1849... Línea 1849...
1849
 
1849
 
1850
    /**
1850
    /**
1851
     * Test get posts discussions including rating information.
1851
     * Test get posts discussions including rating information.
1852
     */
1852
     */
1853
    public function test_mod_forum_get_discussion_rating_information() {
1853
    public function test_mod_forum_get_discussion_rating_information(): void {
1854
        global $DB, $CFG, $PAGE;
1854
        global $DB, $CFG, $PAGE;
1855
        require_once($CFG->dirroot . '/rating/lib.php');
1855
        require_once($CFG->dirroot . '/rating/lib.php');
1856
        $PAGE->set_url('/my/index.php');    // Need this because some internal API calls require the $PAGE url to be set.
1856
        $PAGE->set_url('/my/index.php');    // Need this because some internal API calls require the $PAGE url to be set.
Línea 1940... Línea 1940...
1940
    }
1940
    }
Línea 1941... Línea 1941...
1941
 
1941
 
1942
    /**
1942
    /**
1943
     * Test mod_forum_get_forum_access_information.
1943
     * Test mod_forum_get_forum_access_information.
1944
     */
1944
     */
1945
    public function test_mod_forum_get_forum_access_information() {
1945
    public function test_mod_forum_get_forum_access_information(): void {
Línea 1946... Línea 1946...
1946
        global $DB;
1946
        global $DB;
Línea 1947... Línea 1947...
1947
 
1947
 
Línea 1993... Línea 1993...
1993
    }
1993
    }
Línea 1994... Línea 1994...
1994
 
1994
 
1995
    /**
1995
    /**
1996
     * Test add_discussion_post
1996
     * Test add_discussion_post
1997
     */
1997
     */
1998
    public function test_add_discussion_post_private() {
1998
    public function test_add_discussion_post_private(): void {
Línea 1999... Línea 1999...
1999
        global $DB;
1999
        global $DB;
Línea 2000... Línea 2000...
2000
 
2000
 
Línea 2087... Línea 2087...
2087
    }
2087
    }
Línea 2088... Línea 2088...
2088
 
2088
 
2089
    /**
2089
    /**
2090
     * Test trusted text enabled.
2090
     * Test trusted text enabled.
2091
     */
2091
     */
2092
    public function test_trusted_text_enabled() {
2092
    public function test_trusted_text_enabled(): void {
Línea 2093... Línea 2093...
2093
        global $USER, $CFG;
2093
        global $USER, $CFG;
2094
 
2094
 
Línea 2148... Línea 2148...
2148
    }
2148
    }
Línea 2149... Línea 2149...
2149
 
2149
 
2150
    /**
2150
    /**
2151
     * Test trusted text disabled.
2151
     * Test trusted text disabled.
2152
     */
2152
     */
2153
    public function test_trusted_text_disabled() {
2153
    public function test_trusted_text_disabled(): void {
Línea 2154... Línea 2154...
2154
        global $USER, $CFG;
2154
        global $USER, $CFG;
2155
 
2155
 
Línea 2209... Línea 2209...
2209
    }
2209
    }
Línea 2210... Línea 2210...
2210
 
2210
 
2211
    /**
2211
    /**
2212
     * Test delete a discussion.
2212
     * Test delete a discussion.
2213
     */
2213
     */
2214
    public function test_delete_post_discussion() {
2214
    public function test_delete_post_discussion(): void {
2215
        global $DB;
2215
        global $DB;
Línea 2216... Línea 2216...
2216
        $this->resetAfterTest(true);
2216
        $this->resetAfterTest(true);
2217
 
2217
 
Línea 2238... Línea 2238...
2238
    }
2238
    }
Línea 2239... Línea 2239...
2239
 
2239
 
2240
    /**
2240
    /**
2241
     * Test delete a post.
2241
     * Test delete a post.
2242
     */
2242
     */
2243
    public function test_delete_post_post() {
2243
    public function test_delete_post_post(): void {
2244
        global $DB;
2244
        global $DB;
Línea 2245... Línea 2245...
2245
        $this->resetAfterTest(true);
2245
        $this->resetAfterTest(true);
2246
 
2246
 
Línea 2277... Línea 2277...
2277
    }
2277
    }
Línea 2278... Línea 2278...
2278
 
2278
 
2279
    /**
2279
    /**
2280
     * Test delete a different user post.
2280
     * Test delete a different user post.
2281
     */
2281
     */
2282
    public function test_delete_post_other_user_post() {
2282
    public function test_delete_post_other_user_post(): void {
2283
        global $DB;
2283
        global $DB;
Línea 2284... Línea 2284...
2284
        $this->resetAfterTest(true);
2284
        $this->resetAfterTest(true);
2285
 
2285
 
Línea 2315... Línea 2315...
2315
    }
2315
    }
Línea 2316... Línea 2316...
2316
 
2316
 
2317
    /*
2317
    /*
2318
     * Test get forum posts by user id.
2318
     * Test get forum posts by user id.
2319
     */
2319
     */
2320
    public function test_mod_forum_get_discussion_posts_by_userid() {
2320
    public function test_mod_forum_get_discussion_posts_by_userid(): void {
2321
        global $DB;
2321
        global $DB;
Línea 2322... Línea 2322...
2322
        $this->resetAfterTest(true);
2322
        $this->resetAfterTest(true);
2323
 
2323
 
Línea 2774... Línea 2774...
2774
    }
2774
    }
Línea 2775... Línea 2775...
2775
 
2775
 
2776
    /**
2776
    /**
2777
     * Test get_discussion_post a discussion.
2777
     * Test get_discussion_post a discussion.
2778
     */
2778
     */
2779
    public function test_get_discussion_post_discussion() {
2779
    public function test_get_discussion_post_discussion(): void {
2780
        global $DB;
2780
        global $DB;
2781
        $this->resetAfterTest(true);
2781
        $this->resetAfterTest(true);
2782
        // Setup test data.
2782
        // Setup test data.
2783
        $course = $this->getDataGenerator()->create_course();
2783
        $course = $this->getDataGenerator()->create_course();
Línea 2800... Línea 2800...
2800
    }
2800
    }
Línea 2801... Línea 2801...
2801
 
2801
 
2802
    /**
2802
    /**
2803
     * Test get_discussion_post a post.
2803
     * Test get_discussion_post a post.
2804
     */
2804
     */
2805
    public function test_get_discussion_post_post() {
2805
    public function test_get_discussion_post_post(): void {
2806
        global $DB;
2806
        global $DB;
2807
        $this->resetAfterTest(true);
2807
        $this->resetAfterTest(true);
2808
        // Setup test data.
2808
        // Setup test data.
2809
        $course = $this->getDataGenerator()->create_course();
2809
        $course = $this->getDataGenerator()->create_course();
Línea 2835... Línea 2835...
2835
    }
2835
    }
Línea 2836... Línea 2836...
2836
 
2836
 
2837
    /**
2837
    /**
2838
     * Test get_discussion_post a different user post.
2838
     * Test get_discussion_post a different user post.
2839
     */
2839
     */
2840
    public function test_get_discussion_post_other_user_post() {
2840
    public function test_get_discussion_post_other_user_post(): void {
2841
        global $DB;
2841
        global $DB;
2842
        $this->resetAfterTest(true);
2842
        $this->resetAfterTest(true);
2843
        // Setup test data.
2843
        // Setup test data.
2844
        $course = $this->getDataGenerator()->create_course();
2844
        $course = $this->getDataGenerator()->create_course();
Línea 2873... Línea 2873...
2873
    }
2873
    }
Línea 2874... Línea 2874...
2874
 
2874
 
2875
    /**
2875
    /**
2876
     * Test prepare_draft_area_for_post a different user post.
2876
     * Test prepare_draft_area_for_post a different user post.
2877
     */
2877
     */
2878
    public function test_prepare_draft_area_for_post() {
2878
    public function test_prepare_draft_area_for_post(): void {
2879
        global $DB;
2879
        global $DB;
2880
        $this->resetAfterTest(true);
2880
        $this->resetAfterTest(true);
2881
        // Setup test data.
2881
        // Setup test data.
2882
        $course = $this->getDataGenerator()->create_course();
2882
        $course = $this->getDataGenerator()->create_course();
Línea 2950... Línea 2950...
2950
    }
2950
    }
Línea 2951... Línea 2951...
2951
 
2951
 
2952
    /**
2952
    /**
2953
     * Test update_discussion_post with a discussion.
2953
     * Test update_discussion_post with a discussion.
2954
     */
2954
     */
2955
    public function test_update_discussion_post_discussion() {
2955
    public function test_update_discussion_post_discussion(): void {
2956
        global $DB, $USER;
2956
        global $DB, $USER;
2957
        $this->resetAfterTest(true);
2957
        $this->resetAfterTest(true);
2958
        // Setup test data.
2958
        // Setup test data.
2959
        $course = $this->getDataGenerator()->create_course();
2959
        $course = $this->getDataGenerator()->create_course();
Línea 2995... Línea 2995...
2995
    }
2995
    }
Línea 2996... Línea 2996...
2996
 
2996
 
2997
    /**
2997
    /**
2998
     * Test update_discussion_post with a post.
2998
     * Test update_discussion_post with a post.
2999
     */
2999
     */
3000
    public function test_update_discussion_post_post() {
3000
    public function test_update_discussion_post_post(): void {
3001
        global $DB, $USER;
3001
        global $DB, $USER;
3002
        $this->resetAfterTest(true);
3002
        $this->resetAfterTest(true);
3003
        // Setup test data.
3003
        // Setup test data.
3004
        $course = $this->getDataGenerator()->create_course();
3004
        $course = $this->getDataGenerator()->create_course();
Línea 3087... Línea 3087...
3087
    }
3087
    }
Línea 3088... Línea 3088...
3088
 
3088
 
3089
    /**
3089
    /**
3090
     * Test update_discussion_post with other user post (no permissions).
3090
     * Test update_discussion_post with other user post (no permissions).
3091
     */
3091
     */
3092
    public function test_update_discussion_post_other_user_post() {
3092
    public function test_update_discussion_post_other_user_post(): void {
3093
        global $DB, $USER;
3093
        global $DB, $USER;
3094
        $this->resetAfterTest(true);
3094
        $this->resetAfterTest(true);
3095
        // Setup test data.
3095
        // Setup test data.
3096
        $course = $this->getDataGenerator()->create_course();
3096
        $course = $this->getDataGenerator()->create_course();