Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 103... Línea 103...
103
 
103
 
104
    /**
104
    /**
105
     * Get global public entries even for not authenticated users.
105
     * Get global public entries even for not authenticated users.
106
     * We get the entry since is public.
106
     * We get the entry since is public.
107
     */
107
     */
108
    public function test_get_public_entries_global_level_by_non_logged_users() {
108
    public function test_get_public_entries_global_level_by_non_logged_users(): void {
Línea 109... Línea 109...
109
        global $CFG, $DB;
109
        global $CFG, $DB;
110
 
110
 
111
        $CFG->bloglevel = BLOG_GLOBAL_LEVEL;
111
        $CFG->bloglevel = BLOG_GLOBAL_LEVEL;
Línea 124... Línea 124...
124
    }
124
    }
Línea 125... Línea 125...
125
 
125
 
126
    /**
126
    /**
127
     * Get global public entries even for not authenticated users in closed site.
127
     * Get global public entries even for not authenticated users in closed site.
128
     */
128
     */
129
    public function test_get_public_entries_global_level_by_non_logged_users_closed_site() {
129
    public function test_get_public_entries_global_level_by_non_logged_users_closed_site(): void {
Línea 130... Línea 130...
130
        global $CFG, $DB;
130
        global $CFG, $DB;
131
 
131
 
132
        $CFG->bloglevel = BLOG_GLOBAL_LEVEL;
132
        $CFG->bloglevel = BLOG_GLOBAL_LEVEL;
Línea 140... Línea 140...
140
 
140
 
141
    /**
141
    /**
142
     * Get global public entries for guest users.
142
     * Get global public entries for guest users.
143
     * We get the entry since is public.
143
     * We get the entry since is public.
144
     */
144
     */
145
    public function test_get_public_entries_global_level_by_guest_users() {
145
    public function test_get_public_entries_global_level_by_guest_users(): void {
Línea 146... Línea 146...
146
        global $CFG, $DB;
146
        global $CFG, $DB;
147
 
147
 
148
        $CFG->bloglevel = BLOG_GLOBAL_LEVEL;
148
        $CFG->bloglevel = BLOG_GLOBAL_LEVEL;
Línea 161... Línea 161...
161
 
161
 
162
    /**
162
    /**
163
     * Get global not public entries even for not authenticated users withouth being authenticated.
163
     * Get global not public entries even for not authenticated users withouth being authenticated.
164
     * We don't get any because they are not public (restricted to site users).
164
     * We don't get any because they are not public (restricted to site users).
165
     */
165
     */
166
    public function test_get_not_public_entries_global_level_by_non_logged_users() {
166
    public function test_get_not_public_entries_global_level_by_non_logged_users(): void {
Línea 167... Línea 167...
167
        global $CFG;
167
        global $CFG;
Línea 168... Línea 168...
168
 
168
 
Línea 175... Línea 175...
175
 
175
 
176
    /**
176
    /**
177
     * Get global not public entries users being guest.
177
     * Get global not public entries users being guest.
178
     * We don't get any because they are not public (restricted to real site users).
178
     * We don't get any because they are not public (restricted to real site users).
179
     */
179
     */
180
    public function test_get_not_public_entries_global_level_by_guest_user() {
180
    public function test_get_not_public_entries_global_level_by_guest_user(): void {
Línea 181... Línea 181...
181
        global $CFG;
181
        global $CFG;
Línea 182... Línea 182...
182
 
182
 
Línea 190... Línea 190...
190
 
190
 
191
    /**
191
    /**
192
     * Get site not public entries for not authenticated users.
192
     * Get site not public entries for not authenticated users.
193
     * We don't get any because they are not public (restricted to real site users).
193
     * We don't get any because they are not public (restricted to real site users).
194
     */
194
     */
195
    public function test_get_not_public_entries_site_level_by_non_logged_users() {
195
    public function test_get_not_public_entries_site_level_by_non_logged_users(): void {
196
        $this->expectException('require_login_exception'); // In this case we get a security exception.
196
        $this->expectException('require_login_exception'); // In this case we get a security exception.
197
        $result = \core_blog\external::get_entries();
197
        $result = \core_blog\external::get_entries();
Línea 198... Línea 198...
198
    }
198
    }
199
 
199
 
200
    /**
200
    /**
201
     * Get site not public entries for guest users.
201
     * Get site not public entries for guest users.
202
     * We don't get any because they are not public (restricted to real site users).
202
     * We don't get any because they are not public (restricted to real site users).
Línea 203... Línea 203...
203
     */
203
     */
204
    public function test_get_not_public_entries_site_level_by_guest_users() {
204
    public function test_get_not_public_entries_site_level_by_guest_users(): void {
205
 
205
 
206
        $this->setGuestUser();
206
        $this->setGuestUser();
207
        $result = \core_blog\external::get_entries();
207
        $result = \core_blog\external::get_entries();
Línea 208... Línea 208...
208
        $result = external_api::clean_returnvalue(\core_blog\external::get_entries_returns(), $result);
208
        $result = external_api::clean_returnvalue(\core_blog\external::get_entries_returns(), $result);
209
        $this->assertCount(0, $result['entries']);
209
        $this->assertCount(0, $result['entries']);
210
    }
210
    }
211
 
211
 
Línea 212... Línea 212...
212
    /**
212
    /**
213
     * Get site entries at site level by system users.
213
     * Get site entries at site level by system users.
214
     */
214
     */
215
    public function test_get_site_entries_site_level_by_normal_users() {
215
    public function test_get_site_entries_site_level_by_normal_users(): void {
Línea 222... Línea 222...
222
    }
222
    }
Línea 223... Línea 223...
223
 
223
 
224
    /**
224
    /**
225
     * Get draft site entries by authors.
225
     * Get draft site entries by authors.
226
     */
226
     */
227
    public function test_get_draft_entries_site_level_by_author_users() {
227
    public function test_get_draft_entries_site_level_by_author_users(): void {
Línea 228... Línea 228...
228
        global $DB;
228
        global $DB;
229
 
229
 
Línea 238... Línea 238...
238
    }
238
    }
Línea 239... Línea 239...
239
 
239
 
240
    /**
240
    /**
241
     * Get draft site entries by not authors.
241
     * Get draft site entries by not authors.
242
     */
242
     */
243
    public function test_get_draft_entries_site_level_by_not_author_users() {
243
    public function test_get_draft_entries_site_level_by_not_author_users(): void {
Línea 244... Línea 244...
244
        global $DB;
244
        global $DB;
245
 
245
 
246
        // Set current entry global.
246
        // Set current entry global.
Línea 254... Línea 254...
254
    }
254
    }
Línea 255... Línea 255...
255
 
255
 
256
    /**
256
    /**
257
     * Get draft site entries by admin.
257
     * Get draft site entries by admin.
258
     */
258
     */
259
    public function test_get_draft_entries_site_level_by_admin_users() {
259
    public function test_get_draft_entries_site_level_by_admin_users(): void {
Línea 260... Línea 260...
260
        global $DB;
260
        global $DB;
261
 
261
 
262
        // Set current entry global.
262
        // Set current entry global.
Línea 272... Línea 272...
272
    }
272
    }
Línea 273... Línea 273...
273
 
273
 
274
    /**
274
    /**
275
     * Get draft user entries by authors.
275
     * Get draft user entries by authors.
276
     */
276
     */
277
    public function test_get_draft_entries_user_level_by_author_users() {
277
    public function test_get_draft_entries_user_level_by_author_users(): void {
Línea 278... Línea 278...
278
        global $CFG, $DB;
278
        global $CFG, $DB;
279
 
279
 
280
        $CFG->bloglevel = BLOG_USER_LEVEL;
280
        $CFG->bloglevel = BLOG_USER_LEVEL;
Línea 290... Línea 290...
290
    }
290
    }
Línea 291... Línea 291...
291
 
291
 
292
    /**
292
    /**
293
     * Get draft user entries by not authors.
293
     * Get draft user entries by not authors.
294
     */
294
     */
295
    public function test_get_draft_entries_user_level_by_not_author_users() {
295
    public function test_get_draft_entries_user_level_by_not_author_users(): void {
Línea 296... Línea 296...
296
        global $CFG, $DB;
296
        global $CFG, $DB;
297
 
297
 
298
        $CFG->bloglevel = BLOG_USER_LEVEL;
298
        $CFG->bloglevel = BLOG_USER_LEVEL;
Línea 307... Línea 307...
307
    }
307
    }
Línea 308... Línea 308...
308
 
308
 
309
    /**
309
    /**
310
     * Get draft user entries by admin.
310
     * Get draft user entries by admin.
311
     */
311
     */
312
    public function test_get_draft_entries_user_level_by_admin_users() {
312
    public function test_get_draft_entries_user_level_by_admin_users(): void {
Línea 313... Línea 313...
313
        global $CFG, $DB;
313
        global $CFG, $DB;
314
 
314
 
315
        $CFG->bloglevel = BLOG_USER_LEVEL;
315
        $CFG->bloglevel = BLOG_USER_LEVEL;
Línea 325... Línea 325...
325
    }
325
    }
Línea 326... Línea 326...
326
 
326
 
327
    /**
327
    /**
328
     * Test get all entries including testing pagination.
328
     * Test get all entries including testing pagination.
329
     */
329
     */
330
    public function test_get_all_entries_including_pagination() {
330
    public function test_get_all_entries_including_pagination(): void {
Línea 331... Línea 331...
331
        global $DB, $USER;
331
        global $DB, $USER;
Línea 332... Línea 332...
332
 
332
 
Línea 366... Línea 366...
366
    }
366
    }
Línea 367... Línea 367...
367
 
367
 
368
    /**
368
    /**
369
     * Test get entries filtering by course.
369
     * Test get entries filtering by course.
370
     */
370
     */
371
    public function test_get_entries_filtering_by_course() {
371
    public function test_get_entries_filtering_by_course(): void {
Línea 372... Línea 372...
372
        global $CFG, $DB;
372
        global $CFG, $DB;
Línea 373... Línea 373...
373
 
373
 
Línea 400... Línea 400...
400
    }
400
    }
Línea 401... Línea 401...
401
 
401
 
402
    /**
402
    /**
403
     * Test get entries filtering by module.
403
     * Test get entries filtering by module.
404
     */
404
     */
405
    public function test_get_entries_filtering_by_module() {
405
    public function test_get_entries_filtering_by_module(): void {
Línea 406... Línea 406...
406
        global $CFG, $DB;
406
        global $CFG, $DB;
Línea 407... Línea 407...
407
 
407
 
Línea 433... Línea 433...
433
    }
433
    }
Línea 434... Línea 434...
434
 
434
 
435
    /**
435
    /**
436
     * Test get entries filtering by author.
436
     * Test get entries filtering by author.
437
     */
437
     */
438
    public function test_get_entries_filtering_by_author() {
438
    public function test_get_entries_filtering_by_author(): void {
439
        $this->setAdminUser();
439
        $this->setAdminUser();
440
        // Filter by author.
440
        // Filter by author.
441
        $result = \core_blog\external::get_entries(array(array('name' => 'userid', 'value' => $this->userid)));
441
        $result = \core_blog\external::get_entries(array(array('name' => 'userid', 'value' => $this->userid)));
442
        $result = external_api::clean_returnvalue(\core_blog\external::get_entries_returns(), $result);
442
        $result = external_api::clean_returnvalue(\core_blog\external::get_entries_returns(), $result);
Línea 449... Línea 449...
449
    }
449
    }
Línea 450... Línea 450...
450
 
450
 
451
    /**
451
    /**
452
     * Test get entries filtering by entry.
452
     * Test get entries filtering by entry.
453
     */
453
     */
454
    public function test_get_entries_filtering_by_entry() {
454
    public function test_get_entries_filtering_by_entry(): void {
455
        $this->setAdminUser();
455
        $this->setAdminUser();
456
        // Filter by correct entry.
456
        // Filter by correct entry.
457
        $result = \core_blog\external::get_entries(array(array('name' => 'entryid', 'value' => $this->postid)));
457
        $result = \core_blog\external::get_entries(array(array('name' => 'entryid', 'value' => $this->postid)));
458
        $result = external_api::clean_returnvalue(\core_blog\external::get_entries_returns(), $result);
458
        $result = external_api::clean_returnvalue(\core_blog\external::get_entries_returns(), $result);
Línea 463... Línea 463...
463
    }
463
    }
Línea 464... Línea 464...
464
 
464
 
465
    /**
465
    /**
466
     * Test get entries filtering by search.
466
     * Test get entries filtering by search.
467
     */
467
     */
468
    public function test_get_entries_filtering_by_search() {
468
    public function test_get_entries_filtering_by_search(): void {
469
        $this->setAdminUser();
469
        $this->setAdminUser();
470
        // Filter by correct search.
470
        // Filter by correct search.
471
        $result = \core_blog\external::get_entries(array(array('name' => 'search', 'value' => 'test')));
471
        $result = \core_blog\external::get_entries(array(array('name' => 'search', 'value' => 'test')));
472
        $result = external_api::clean_returnvalue(\core_blog\external::get_entries_returns(), $result);
472
        $result = external_api::clean_returnvalue(\core_blog\external::get_entries_returns(), $result);
Línea 478... Línea 478...
478
    }
478
    }
Línea 479... Línea 479...
479
 
479
 
480
    /**
480
    /**
481
     * Test get entries filtering by tag.
481
     * Test get entries filtering by tag.
482
     */
482
     */
483
    public function test_get_entries_filtering_by_tag() {
483
    public function test_get_entries_filtering_by_tag(): void {
484
        $this->setAdminUser();
484
        $this->setAdminUser();
485
        // Filter by correct tag.
485
        // Filter by correct tag.
486
        $result = \core_blog\external::get_entries(array(array('name' => 'tag', 'value' => 'tag1')));
486
        $result = \core_blog\external::get_entries(array(array('name' => 'tag', 'value' => 'tag1')));
487
        $result = external_api::clean_returnvalue(\core_blog\external::get_entries_returns(), $result);
487
        $result = external_api::clean_returnvalue(\core_blog\external::get_entries_returns(), $result);
Línea 496... Línea 496...
496
    }
496
    }
Línea 497... Línea 497...
497
 
497
 
498
    /**
498
    /**
499
     * Test get entries filtering by tag id.
499
     * Test get entries filtering by tag id.
500
     */
500
     */
501
    public function test_get_entries_filtering_by_tagid() {
501
    public function test_get_entries_filtering_by_tagid(): void {
502
        $this->setAdminUser();
502
        $this->setAdminUser();
503
        // Filter by correct tag.
503
        // Filter by correct tag.
504
        $result = \core_blog\external::get_entries(array(array('name' => 'tagid', 'value' => $this->tagid)));
504
        $result = \core_blog\external::get_entries(array(array('name' => 'tagid', 'value' => $this->tagid)));
505
        $result = external_api::clean_returnvalue(\core_blog\external::get_entries_returns(), $result);
505
        $result = external_api::clean_returnvalue(\core_blog\external::get_entries_returns(), $result);
Línea 516... Línea 516...
516
    }
516
    }
Línea 517... Línea 517...
517
 
517
 
518
    /**
518
    /**
519
     * Test get entries filtering by group.
519
     * Test get entries filtering by group.
520
     */
520
     */
521
    public function test_get_entries_filtering_by_group() {
521
    public function test_get_entries_filtering_by_group(): void {
522
        $this->setAdminUser();
522
        $this->setAdminUser();
523
        // Add blog associations with a course.
523
        // Add blog associations with a course.
524
        $coursecontext = \context_course::instance($this->courseid);
524
        $coursecontext = \context_course::instance($this->courseid);
525
        $blog = new \blog_entry($this->postid);
525
        $blog = new \blog_entry($this->postid);
Línea 536... Línea 536...
536
    }
536
    }
Línea 537... Línea 537...
537
 
537
 
538
    /**
538
    /**
539
     * Test get entries multiple filter.
539
     * Test get entries multiple filter.
540
     */
540
     */
541
    public function test_get_entries_multiple_filter() {
541
    public function test_get_entries_multiple_filter(): void {
542
        $this->setAdminUser();
542
        $this->setAdminUser();
543
        // Add blog associations with a course.
543
        // Add blog associations with a course.
544
        $coursecontext = \context_course::instance($this->courseid);
544
        $coursecontext = \context_course::instance($this->courseid);
545
        $blog = new \blog_entry($this->postid);
545
        $blog = new \blog_entry($this->postid);
Línea 562... Línea 562...
562
    }
562
    }
Línea 563... Línea 563...
563
 
563
 
564
    /**
564
    /**
565
     * Test get entries filtering by invalid_filter.
565
     * Test get entries filtering by invalid_filter.
566
     */
566
     */
567
    public function test_get_entries_filtering_by_invalid_filter() {
567
    public function test_get_entries_filtering_by_invalid_filter(): void {
568
        $this->setAdminUser();
568
        $this->setAdminUser();
569
        // Filter by incorrect filter.
569
        // Filter by incorrect filter.
570
        $this->expectException('\moodle_exception');
570
        $this->expectException('\moodle_exception');
571
        $result = \core_blog\external::get_entries(array(array('name' => 'zzZZzz', 'value' => 'wwWWww')));
571
        $result = \core_blog\external::get_entries(array(array('name' => 'zzZZzz', 'value' => 'wwWWww')));
Línea 572... Línea 572...
572
    }
572
    }
573
 
573
 
574
    /**
574
    /**
575
     * Test get entries when blog is disabled.
575
     * Test get entries when blog is disabled.
576
     */
576
     */
Línea 577... Línea 577...
577
    public function test_get_entries_blog_disabled() {
577
    public function test_get_entries_blog_disabled(): void {
578
        global $CFG;
578
        global $CFG;
579
 
579
 
Línea 585... Línea 585...
585
    }
585
    }
Línea 586... Línea 586...
586
 
586
 
587
    /**
587
    /**
588
     * Test view_blog_entries without filter.
588
     * Test view_blog_entries without filter.
589
     */
589
     */
590
    public function test_view_blog_entries_without_filtering() {
590
    public function test_view_blog_entries_without_filtering(): void {
591
        // Test user with full capabilities.
591
        // Test user with full capabilities.
592
        $this->setUser($this->userid);
592
        $this->setUser($this->userid);
593
        // Trigger and capture the event.
593
        // Trigger and capture the event.
594
        $sink = $this->redirectEvents();
594
        $sink = $this->redirectEvents();
Línea 613... Línea 613...
613
    }
613
    }
Línea 614... Línea 614...
614
 
614
 
615
    /**
615
    /**
616
     * Test view_blog_entries doing filtering.
616
     * Test view_blog_entries doing filtering.
617
     */
617
     */
618
    public function test_view_blog_entries_with_filtering() {
618
    public function test_view_blog_entries_with_filtering(): void {
619
        // Test user with full capabilities.
619
        // Test user with full capabilities.
620
        $this->setUser($this->userid);
620
        $this->setUser($this->userid);
621
        // Trigger and capture the event.
621
        // Trigger and capture the event.
622
        $sink = $this->redirectEvents();
622
        $sink = $this->redirectEvents();
Línea 644... Línea 644...
644
    }
644
    }
Línea 645... Línea 645...
645
 
645
 
646
    /**
646
    /**
647
     * Test get_access_information
647
     * Test get_access_information
648
     */
648
     */
649
    public function test_get_access_information() {
649
    public function test_get_access_information(): void {
Línea 650... Línea 650...
650
        global $CFG;
650
        global $CFG;
651
 
651
 
652
        $this->setAdminUser();
652
        $this->setAdminUser();
Línea 675... Línea 675...
675
    }
675
    }
Línea 676... Línea 676...
676
 
676
 
677
    /**
677
    /**
678
     * Test add_entry
678
     * Test add_entry
679
     */
679
     */
680
    public function test_add_entry() {
680
    public function test_add_entry(): void {
Línea 681... Línea 681...
681
        global $USER;
681
        global $USER;
Línea 682... Línea 682...
682
 
682
 
Línea 752... Línea 752...
752
    }
752
    }
Línea 753... Línea 753...
753
 
753
 
754
    /**
754
    /**
755
     * Test add_entry when blogs not enabled.
755
     * Test add_entry when blogs not enabled.
756
     */
756
     */
757
    public function test_add_entry_blog_not_enabled() {
757
    public function test_add_entry_blog_not_enabled(): void {
Línea 758... Línea 758...
758
        global $CFG;
758
        global $CFG;
759
 
759
 
760
        $this->resetAfterTest(true);
760
        $this->resetAfterTest(true);
Línea 767... Línea 767...
767
    }
767
    }
Línea 768... Línea 768...
768
 
768
 
769
    /**
769
    /**
770
     * Test add_entry without permissions.
770
     * Test add_entry without permissions.
771
     */
771
     */
772
    public function test_add_entry_no_permission() {
772
    public function test_add_entry_no_permission(): void {
Línea 773... Línea 773...
773
        global $CFG;
773
        global $CFG;
Línea 774... Línea 774...
774
 
774
 
Línea 786... Línea 786...
786
    }
786
    }
Línea 787... Línea 787...
787
 
787
 
788
    /**
788
    /**
789
     * Test add_entry invalid parameter.
789
     * Test add_entry invalid parameter.
790
     */
790
     */
791
    public function test_add_entry_invalid_parameter() {
791
    public function test_add_entry_invalid_parameter(): void {
792
        $this->resetAfterTest(true);
792
        $this->resetAfterTest(true);
Línea 793... Línea 793...
793
        $this->setAdminUser();
793
        $this->setAdminUser();
794
 
794
 
Línea 799... Línea 799...
799
    }
799
    }
Línea 800... Línea 800...
800
 
800
 
801
    /**
801
    /**
802
     * Test add_entry diabled associations.
802
     * Test add_entry diabled associations.
803
     */
803
     */
804
    public function test_add_entry_disabled_assoc() {
804
    public function test_add_entry_disabled_assoc(): void {
805
        global $CFG;
805
        global $CFG;
Línea 806... Línea 806...
806
        $CFG->useblogassociations = 0;
806
        $CFG->useblogassociations = 0;
807
 
807
 
Línea 815... Línea 815...
815
    }
815
    }
Línea 816... Línea 816...
816
 
816
 
817
    /**
817
    /**
818
     * Test add_entry invalid publish state.
818
     * Test add_entry invalid publish state.
819
     */
819
     */
820
    public function test_add_entry_invalid_publishstate() {
820
    public function test_add_entry_invalid_publishstate(): void {
821
        $this->resetAfterTest(true);
821
        $this->resetAfterTest(true);
Línea 822... Línea 822...
822
        $this->setAdminUser();
822
        $this->setAdminUser();
823
 
823
 
Línea 828... Línea 828...
828
    }
828
    }
Línea 829... Línea 829...
829
 
829
 
830
    /**
830
    /**
831
     * Test add_entry invalid association.
831
     * Test add_entry invalid association.
832
     */
832
     */
833
    public function test_add_entry_invalid_association() {
833
    public function test_add_entry_invalid_association(): void {
Línea 834... Línea 834...
834
        $this->resetAfterTest(true);
834
        $this->resetAfterTest(true);
835
 
835
 
836
        $course = $this->getDataGenerator()->create_course();
836
        $course = $this->getDataGenerator()->create_course();
Línea 849... Línea 849...
849
    }
849
    }
Línea 850... Línea 850...
850
 
850
 
851
    /**
851
    /**
852
     * Test delete_entry
852
     * Test delete_entry
853
     */
853
     */
854
    public function test_delete_entry() {
854
    public function test_delete_entry(): void {
Línea 855... Línea 855...
855
        $this->resetAfterTest(true);
855
        $this->resetAfterTest(true);
856
 
856
 
Línea 863... Línea 863...
863
    }
863
    }
Línea 864... Línea 864...
864
 
864
 
865
    /**
865
    /**
866
     * Test delete_entry from another user (no permissions)
866
     * Test delete_entry from another user (no permissions)
867
     */
867
     */
868
    public function test_delete_entry_no_permissions() {
868
    public function test_delete_entry_no_permissions(): void {
Línea 869... Línea 869...
869
        $this->resetAfterTest(true);
869
        $this->resetAfterTest(true);
870
 
870
 
Línea 879... Línea 879...
879
    }
879
    }
Línea 880... Línea 880...
880
 
880
 
881
    /**
881
    /**
882
     * Test delete_entry when blogs not enabled.
882
     * Test delete_entry when blogs not enabled.
883
     */
883
     */
884
    public function test_delete_entry_blog_not_enabled() {
884
    public function test_delete_entry_blog_not_enabled(): void {
Línea 885... Línea 885...
885
        global $CFG;
885
        global $CFG;
886
 
886
 
887
        $this->resetAfterTest(true);
887
        $this->resetAfterTest(true);
Línea 894... Línea 894...
894
    }
894
    }
Línea 895... Línea 895...
895
 
895
 
896
    /**
896
    /**
897
     * Test delete_entry invalid entry id.
897
     * Test delete_entry invalid entry id.
898
     */
898
     */
899
    public function test_delete_entry_invalid_entry() {
899
    public function test_delete_entry_invalid_entry(): void {
Línea 900... Línea 900...
900
        global $CFG;
900
        global $CFG;
901
 
901
 
Línea 907... Línea 907...
907
    }
907
    }
Línea 908... Línea 908...
908
 
908
 
909
    /**
909
    /**
910
     * Test prepare_entry_for_edition.
910
     * Test prepare_entry_for_edition.
911
     */
911
     */
912
    public function test_prepare_entry_for_edition() {
912
    public function test_prepare_entry_for_edition(): void {
913
        $this->resetAfterTest(true);
913
        $this->resetAfterTest(true);
Línea 914... Línea 914...
914
        $this->setAdminUser();
914
        $this->setAdminUser();
915
 
915
 
Línea 929... Línea 929...
929
    }
929
    }
Línea 930... Línea 930...
930
 
930
 
931
    /**
931
    /**
932
     * Test prepare_entry_for_edition when blogs not enabled.
932
     * Test prepare_entry_for_edition when blogs not enabled.
933
     */
933
     */
934
    public function test_prepare_entry_for_edition_blog_not_enabled() {
934
    public function test_prepare_entry_for_edition_blog_not_enabled(): void {
Línea 935... Línea 935...
935
        global $CFG;
935
        global $CFG;
936
 
936
 
937
        $this->resetAfterTest(true);
937
        $this->resetAfterTest(true);
Línea 944... Línea 944...
944
    }
944
    }
Línea 945... Línea 945...
945
 
945
 
946
    /**
946
    /**
947
     * Test prepare_entry_for_edition invalid entry id.
947
     * Test prepare_entry_for_edition invalid entry id.
948
     */
948
     */
949
    public function test_prepare_entry_for_edition_invalid_entry() {
949
    public function test_prepare_entry_for_edition_invalid_entry(): void {
950
        $this->resetAfterTest(true);
950
        $this->resetAfterTest(true);
Línea 951... Línea 951...
951
        $this->setAdminUser();
951
        $this->setAdminUser();
952
 
952
 
953
        $this->expectException('\moodle_exception');
953
        $this->expectException('\moodle_exception');
Línea 954... Línea 954...
954
        prepare_entry_for_edition::execute($this->postid + 1000);
954
        prepare_entry_for_edition::execute($this->postid + 1000);
955
    }
955
    }
956
 
956
 
957
    /**
957
    /**
958
     * Test prepare_entry_for_edition without permissions.
958
     * Test prepare_entry_for_edition without permissions.
Línea 959... Línea 959...
959
     */
959
     */
960
    public function test_prepare_entry_for_edition_no_permission() {
960
    public function test_prepare_entry_for_edition_no_permission(): void {
961
        $this->resetAfterTest(true);
961
        $this->resetAfterTest(true);
Línea 970... Línea 970...
970
    }
970
    }
Línea 971... Línea 971...
971
 
971
 
972
    /**
972
    /**
973
     * Test update_entry
973
     * Test update_entry
974
     */
974
     */
975
    public function test_update_entry() {
975
    public function test_update_entry(): void {
Línea 976... Línea 976...
976
        global $USER;
976
        global $USER;
Línea 977... Línea 977...
977
 
977
 
Línea 1109... Línea 1109...
1109
    }
1109
    }
Línea 1110... Línea 1110...
1110
 
1110
 
1111
    /**
1111
    /**
1112
     * Test update_entry when blogs not enabled.
1112
     * Test update_entry when blogs not enabled.
1113
     */
1113
     */
1114
    public function test_update_entry_blog_not_enabled() {
1114
    public function test_update_entry_blog_not_enabled(): void {
Línea 1115... Línea 1115...
1115
        global $CFG;
1115
        global $CFG;
1116
 
1116
 
1117
        $this->resetAfterTest(true);
1117
        $this->resetAfterTest(true);
Línea 1124... Línea 1124...
1124
    }
1124
    }
Línea 1125... Línea 1125...
1125
 
1125
 
1126
    /**
1126
    /**
1127
     * Test update_entry without permissions.
1127
     * Test update_entry without permissions.
1128
     */
1128
     */
1129
    public function test_update_entry_no_permission() {
1129
    public function test_update_entry_no_permission(): void {
Línea 1130... Línea 1130...
1130
        global $CFG;
1130
        global $CFG;
Línea 1131... Línea 1131...
1131
 
1131
 
Línea 1143... Línea 1143...
1143
    }
1143
    }
Línea 1144... Línea 1144...
1144
 
1144
 
1145
    /**
1145
    /**
1146
     * Test update_entry invalid parameter.
1146
     * Test update_entry invalid parameter.
1147
     */
1147
     */
1148
    public function test_update_entry_invalid_parameter() {
1148
    public function test_update_entry_invalid_parameter(): void {
1149
        $this->resetAfterTest(true);
1149
        $this->resetAfterTest(true);
Línea 1150... Línea 1150...
1150
        $this->setAdminUser();
1150
        $this->setAdminUser();
1151
 
1151
 
Línea 1156... Línea 1156...
1156
    }
1156
    }
Línea 1157... Línea 1157...
1157
 
1157
 
1158
    /**
1158
    /**
1159
     * Test update_entry diabled associations.
1159
     * Test update_entry diabled associations.
1160
     */
1160
     */
1161
    public function test_update_entry_disabled_assoc() {
1161
    public function test_update_entry_disabled_assoc(): void {
1162
        global $CFG;
1162
        global $CFG;
Línea 1163... Línea 1163...
1163
        $CFG->useblogassociations = 0;
1163
        $CFG->useblogassociations = 0;
1164
 
1164
 
Línea 1172... Línea 1172...
1172
    }
1172
    }
Línea 1173... Línea 1173...
1173
 
1173
 
1174
    /**
1174
    /**
1175
     * Test update_entry invalid publish state.
1175
     * Test update_entry invalid publish state.
1176
     */
1176
     */
1177
    public function test_update_entry_invalid_publishstate() {
1177
    public function test_update_entry_invalid_publishstate(): void {
1178
        $this->resetAfterTest(true);
1178
        $this->resetAfterTest(true);
Línea 1179... Línea 1179...
1179
        $this->setAdminUser();
1179
        $this->setAdminUser();
1180
 
1180
 
Línea 1185... Línea 1185...
1185
    }
1185
    }
Línea 1186... Línea 1186...
1186
 
1186
 
1187
    /**
1187
    /**
1188
     * Test update_entry invalid association.
1188
     * Test update_entry invalid association.
1189
     */
1189
     */
1190
    public function test_update_entry_invalid_association() {
1190
    public function test_update_entry_invalid_association(): void {
Línea 1191... Línea 1191...
1191
        $this->resetAfterTest(true);
1191
        $this->resetAfterTest(true);
1192
 
1192
 
1193
        $course = $this->getDataGenerator()->create_course();
1193
        $course = $this->getDataGenerator()->create_course();
Línea 1206... Línea 1206...
1206
    }
1206
    }
Línea 1207... Línea 1207...
1207
 
1207
 
1208
    /**
1208
    /**
1209
     * Test update_entry from another user (no permissions)
1209
     * Test update_entry from another user (no permissions)
1210
     */
1210
     */
1211
    public function test_update_entry_no_permissions() {
1211
    public function test_update_entry_no_permissions(): void {
Línea 1212... Línea 1212...
1212
        $this->resetAfterTest(true);
1212
        $this->resetAfterTest(true);
1213
 
1213