Skip to content

Commit bf0fa5e

Browse files
author
Daniela Castellanos
committed
Merge branch 'master' into 'release/4.1+5'
# Conflicts: # theme/snap/version.php
2 parents 732ca7e + 045966e commit bf0fa5e

File tree

3 files changed

+7
-68
lines changed

3 files changed

+7
-68
lines changed

lib.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ function hsuforum_cron() {
609609
$userto->markposts = array();
610610

611611
// Set this so that the capabilities are cached, and environment matches receiving user.
612-
cron_setup_user($userto);
612+
\core\cron::setup_user($userto);
613613

614614
// Reset the caches.
615615
foreach ($coursemodules as $forumid => $unused) {
@@ -673,7 +673,7 @@ function hsuforum_cron() {
673673
// Note: If we want to check that userto and userfrom are not the same person this is probably the spot to do it.
674674

675675
// Setup global $COURSE properly - needed for roles and languages.
676-
cron_setup_user($userto, $course);
676+
\core\cron::setup_user($userto, $course);
677677

678678
// Fill caches.
679679
if (!isset($userto->viewfullnames[$forum->id])) {
@@ -887,7 +887,7 @@ function hsuforum_cron() {
887887
unset($mailcount);
888888
unset($errorcount);
889889

890-
cron_setup_user();
890+
\core\cron::setup_user();
891891

892892
$sitetimezone = core_date::get_server_timezone();
893893

@@ -976,7 +976,7 @@ function hsuforum_cron() {
976976

977977
core_php_time_limit::raise(120); // terminate if processing of any account takes longer than 2 minutes
978978

979-
cron_setup_user();
979+
\core\cron::setup_user();
980980

981981
mtrace(get_string('processingdigest', 'hsuforum', $userid), '... ');
982982

@@ -997,7 +997,7 @@ function hsuforum_cron() {
997997

998998
// Override the language and timezone of the "current" user, so that
999999
// mail is customised for the receiver.
1000-
cron_setup_user($userto);
1000+
\core\cron::setup_user($userto);
10011001

10021002
$postsubject = get_string('digestmailsubject', 'hsuforum', format_string($site->shortname, true));
10031003

@@ -1021,7 +1021,7 @@ function hsuforum_cron() {
10211021
$cm = $coursemodules[$forum->id];
10221022

10231023
//override language
1024-
cron_setup_user($userto, $course);
1024+
\core\cron::setup_user($userto, $course);
10251025

10261026
// Fill caches
10271027
if (!isset($userto->viewfullnames[$forum->id])) {
@@ -1200,7 +1200,7 @@ function hsuforum_cron() {
12001200
$config->digestmailtimelast = $timenow;
12011201
}
12021202

1203-
cron_setup_user();
1203+
\core\cron::setup_user();
12041204

12051205
if (!empty($usermailcount)) {
12061206
mtrace(get_string('digestsentusers', 'hsuforum', $usermailcount));

tests/events_test.php

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ public function test_course_searched() {
102102
// Checking that the event contains the expected values.
103103
$this->assertInstanceOf('\mod_hsuforum\event\course_searched', $event);
104104
$this->assertEquals($coursectx, $event->get_context());
105-
$expected = array($course->id, 'hsuforum', 'search', "search.php?id={$course->id}&search={$searchterm}", $searchterm);
106-
$this->assertEventLegacyLogData($expected, $event);
107105
$this->assertEventContextNotUsed($event);
108106

109107
$this->assertNotEmpty($event->get_name());
@@ -181,8 +179,6 @@ public function test_discussion_created() {
181179
// Check that the event contains the expected values.
182180
$this->assertInstanceOf('\mod_hsuforum\event\discussion_created', $event);
183181
$this->assertEquals($context, $event->get_context());
184-
$expected = array($course->id, 'hsuforum', 'add discussion', "discuss.php?d={$discussion->id}", $discussion->id, $forum->cmid);
185-
$this->assertEventLegacyLogData($expected, $event);
186182
$this->assertEventContextNotUsed($event);
187183

188184
$this->assertNotEmpty($event->get_name());
@@ -336,8 +332,6 @@ public function test_discussion_deleted() {
336332
// Checking that the event contains the expected values.
337333
$this->assertInstanceOf('\mod_hsuforum\event\discussion_deleted', $event);
338334
$this->assertEquals($context, $event->get_context());
339-
$expected = array($course->id, 'hsuforum', 'delete discussion', "view.php?id={$forum->cmid}", $forum->id, $forum->cmid);
340-
$this->assertEventLegacyLogData($expected, $event);
341335
$this->assertEventContextNotUsed($event);
342336

343337
$this->assertNotEmpty($event->get_name());
@@ -445,9 +439,6 @@ public function test_discussion_moved() {
445439
// Checking that the event contains the expected values.
446440
$this->assertInstanceOf('\mod_hsuforum\event\discussion_moved', $event);
447441
$this->assertEquals($context, $event->get_context());
448-
$expected = array($course->id, 'hsuforum', 'move discussion', "discuss.php?d={$discussion->id}",
449-
$discussion->id, $toforum->cmid);
450-
$this->assertEventLegacyLogData($expected, $event);
451442
$this->assertEventContextNotUsed($event);
452443

453444
$this->assertNotEmpty($event->get_name());
@@ -514,9 +505,6 @@ public function test_discussion_viewed() {
514505
// Checking that the event contains the expected values.
515506
$this->assertInstanceOf('\mod_hsuforum\event\discussion_viewed', $event);
516507
$this->assertEquals($context, $event->get_context());
517-
$expected = array($course->id, 'hsuforum', 'view discussion', "discuss.php?d={$discussion->id}",
518-
$discussion->id, $forum->cmid);
519-
$this->assertEventLegacyLogData($expected, $event);
520508
$this->assertEventContextNotUsed($event);
521509

522510
$this->assertNotEmpty($event->get_name());
@@ -566,8 +554,6 @@ public function test_course_module_viewed() {
566554
// Checking that the event contains the expected values.
567555
$this->assertInstanceOf('\mod_hsuforum\event\course_module_viewed', $event);
568556
$this->assertEquals($context, $event->get_context());
569-
$expected = array($course->id, 'hsuforum', 'view forum', "view.php?f={$forum->id}", $forum->id, $forum->cmid);
570-
$this->assertEventLegacyLogData($expected, $event);
571557
$url = new \moodle_url('/mod/hsuforum/view.php', array('f' => $forum->id));
572558
$this->assertEquals($url, $event->get_url());
573559
$this->assertEventContextNotUsed($event);
@@ -666,8 +652,6 @@ public function test_subscription_created() {
666652
// Checking that the event contains the expected values.
667653
$this->assertInstanceOf('\mod_hsuforum\event\subscription_created', $event);
668654
$this->assertEquals($context, $event->get_context());
669-
$expected = array($course->id, 'hsuforum', 'subscribe', "view.php?f={$forum->id}", $forum->id, $forum->cmid);
670-
$this->assertEventLegacyLogData($expected, $event);
671655
$url = new \moodle_url('/mod/hsuforum/subscribers.php', array('id' => $forum->id));
672656
$this->assertEquals($url, $event->get_url());
673657
$this->assertEventContextNotUsed($event);
@@ -766,8 +750,6 @@ public function test_subscription_deleted() {
766750
// Checking that the event contains the expected values.
767751
$this->assertInstanceOf('\mod_hsuforum\event\subscription_deleted', $event);
768752
$this->assertEquals($context, $event->get_context());
769-
$expected = array($course->id, 'hsuforum', 'unsubscribe', "view.php?f={$forum->id}", $forum->id, $forum->cmid);
770-
$this->assertEventLegacyLogData($expected, $event);
771753
$url = new \moodle_url('/mod/hsuforum/subscribers.php', array('id' => $forum->id));
772754
$this->assertEquals($url, $event->get_url());
773755
$this->assertEventContextNotUsed($event);
@@ -857,8 +839,6 @@ public function test_readtracking_enabled() {
857839
// Checking that the event contains the expected values.
858840
$this->assertInstanceOf('\mod_hsuforum\event\readtracking_enabled', $event);
859841
$this->assertEquals($context, $event->get_context());
860-
$expected = array($course->id, 'hsuforum', 'start tracking', "view.php?f={$forum->id}", $forum->id, $forum->cmid);
861-
$this->assertEventLegacyLogData($expected, $event);
862842
$url = new \moodle_url('/mod/hsuforum/view.php', array('f' => $forum->id));
863843
$this->assertEquals($url, $event->get_url());
864844
$this->assertEventContextNotUsed($event);
@@ -948,8 +928,6 @@ public function test_readtracking_disabled() {
948928
// Checking that the event contains the expected values.
949929
$this->assertInstanceOf('\mod_hsuforum\event\readtracking_disabled', $event);
950930
$this->assertEquals($context, $event->get_context());
951-
$expected = array($course->id, 'hsuforum', 'stop tracking', "view.php?f={$forum->id}", $forum->id, $forum->cmid);
952-
$this->assertEventLegacyLogData($expected, $event);
953931
$url = new \moodle_url('/mod/hsuforum/view.php', array('f' => $forum->id));
954932
$this->assertEquals($url, $event->get_url());
955933
$this->assertEventContextNotUsed($event);
@@ -1020,8 +998,6 @@ public function test_subscribers_viewed() {
1020998
// Checking that the event contains the expected values.
1021999
$this->assertInstanceOf('\mod_hsuforum\event\subscribers_viewed', $event);
10221000
$this->assertEquals($context, $event->get_context());
1023-
$expected = array($course->id, 'hsuforum', 'view subscribers', "subscribers.php?id={$forum->id}", $forum->id, $forum->cmid);
1024-
$this->assertEventLegacyLogData($expected, $event);
10251001
$this->assertEventContextNotUsed($event);
10261002

10271003
$this->assertNotEmpty($event->get_name());
@@ -1105,9 +1081,6 @@ public function test_user_report_viewed() {
11051081
// Checking that the event contains the expected values.
11061082
$this->assertInstanceOf('\mod_hsuforum\event\user_report_viewed', $event);
11071083
$this->assertEquals($context, $event->get_context());
1108-
$expected = array($course->id, 'hsuforum', 'user report',
1109-
"user.php?id={$user->id}&mode=discussions&course={$course->id}", $user->id);
1110-
$this->assertEventLegacyLogData($expected, $event);
11111084
$this->assertEventContextNotUsed($event);
11121085

11131086
$this->assertNotEmpty($event->get_name());
@@ -1306,9 +1279,6 @@ public function test_post_created() {
13061279
// Checking that the event contains the expected values.
13071280
$this->assertInstanceOf('\mod_hsuforum\event\post_created', $event);
13081281
$this->assertEquals($context, $event->get_context());
1309-
$expected = array($course->id, 'hsuforum', 'add post', "discuss.php?d={$discussion->id}#p{$post->id}",
1310-
$forum->id, $forum->cmid);
1311-
$this->assertEventLegacyLogData($expected, $event);
13121282
$url = new \moodle_url('/mod/hsuforum/discuss.php', array('d' => $discussion->id));
13131283
$url->set_anchor('p'.$event->objectid);
13141284
$this->assertEquals($url, $event->get_url());
@@ -1359,9 +1329,6 @@ public function test_post_created_single() {
13591329
// Checking that the event contains the expected values.
13601330
$this->assertInstanceOf('\mod_hsuforum\event\post_created', $event);
13611331
$this->assertEquals($context, $event->get_context());
1362-
$expected = array($course->id, 'hsuforum', 'add post', "view.php?f={$forum->id}#p{$post->id}",
1363-
$forum->id, $forum->cmid);
1364-
$this->assertEventLegacyLogData($expected, $event);
13651332
$url = new \moodle_url('/mod/hsuforum/view.php', array('f' => $forum->id));
13661333
$url->set_anchor('p'.$event->objectid);
13671334
$this->assertEquals($url, $event->get_url());
@@ -1567,8 +1534,6 @@ public function test_post_deleted() {
15671534
// Check that the events contain the expected values.
15681535
$this->assertInstanceOf('\mod_hsuforum\event\post_deleted', $event);
15691536
$this->assertEquals(context_module::instance($forum->cmid), $event->get_context());
1570-
$expected = array($course->id, 'hsuforum', 'delete post', "discuss.php?d={$discussion->id}", $lastpost->id, $forum->cmid);
1571-
$this->assertEventLegacyLogData($expected, $event);
15721537
$url = new \moodle_url('/mod/hsuforum/discuss.php', array('d' => $discussion->id));
15731538
$this->assertEquals($url, $event->get_url());
15741539
$this->assertEventContextNotUsed($event);
@@ -1588,8 +1553,6 @@ public function test_post_deleted() {
15881553
// Check that the event contains the expected values.
15891554
$this->assertInstanceOf('\mod_hsuforum\event\post_deleted', $event);
15901555
$this->assertEquals(context_module::instance($forum->cmid), $event->get_context());
1591-
$expected = array($course->id, 'hsuforum', 'delete post', "discuss.php?d={$discussion->id}", $post->id, $forum->cmid);
1592-
$this->assertEventLegacyLogData($expected, $event);
15931556
$url = new \moodle_url('/mod/hsuforum/discuss.php', array('d' => $discussion->id));
15941557
$this->assertEquals($url, $event->get_url());
15951558
$this->assertEventContextNotUsed($event);
@@ -1639,8 +1602,6 @@ public function test_post_deleted_single() {
16391602
// Checking that the event contains the expected values.
16401603
$this->assertInstanceOf('\mod_hsuforum\event\post_deleted', $event);
16411604
$this->assertEquals($context, $event->get_context());
1642-
$expected = array($course->id, 'hsuforum', 'delete post', "view.php?f={$forum->id}", $post->id, $forum->cmid);
1643-
$this->assertEventLegacyLogData($expected, $event);
16441605
$url = new \moodle_url('/mod/hsuforum/view.php', array('f' => $forum->id));
16451606
$this->assertEquals($url, $event->get_url());
16461607
$this->assertEventContextNotUsed($event);
@@ -1818,9 +1779,6 @@ public function test_post_updated() {
18181779
// Checking that the event contains the expected values.
18191780
$this->assertInstanceOf('\mod_hsuforum\event\post_updated', $event);
18201781
$this->assertEquals($context, $event->get_context());
1821-
$expected = array($course->id, 'hsuforum', 'update post', "discuss.php?d={$discussion->id}#p{$post->id}",
1822-
$post->id, $forum->cmid);
1823-
$this->assertEventLegacyLogData($expected, $event);
18241782
$url = new \moodle_url('/mod/hsuforum/discuss.php', array('d' => $discussion->id));
18251783
$url->set_anchor('p'.$event->objectid);
18261784
$this->assertEquals($url, $event->get_url());
@@ -1871,9 +1829,6 @@ public function test_post_updated_single() {
18711829
// Checking that the event contains the expected values.
18721830
$this->assertInstanceOf('\mod_hsuforum\event\post_updated', $event);
18731831
$this->assertEquals($context, $event->get_context());
1874-
$expected = array($course->id, 'hsuforum', 'update post', "view.php?f={$forum->id}#p{$post->id}",
1875-
$post->id, $forum->cmid);
1876-
$this->assertEventLegacyLogData($expected, $event);
18771832
$url = new \moodle_url('/mod/hsuforum/view.php', array('f' => $forum->id));
18781833
$url->set_anchor('p'.$post->id);
18791834
$this->assertEquals($url, $event->get_url());

tests/lib_test.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,6 @@ public function test_hsuforum_trigger_content_uploaded_event() {
7272
$this->assertEquals($fakepost->discussion, $event->other['discussionid']);
7373
$this->assertCount(1, $event->other['pathnamehashes']);
7474
$this->assertEquals($fi->get_pathnamehash(), $event->other['pathnamehashes'][0]);
75-
$expected = new stdClass();
76-
$expected->modulename = 'hsuforum';
77-
$expected->name = 'some triggered from value';
78-
$expected->cmid = $forum->cmid;
79-
$expected->itemid = $fakepost->id;
80-
$expected->courseid = $course->id;
81-
$expected->userid = $user->id;
82-
$expected->content = $fakepost->message;
83-
$expected->pathnamehashes = array($fi->get_pathnamehash());
84-
$this->assertEventLegacyData($expected, $event);
8575
$this->assertEventContextNotUsed($event);
8676
}
8777

@@ -399,9 +389,6 @@ public function test_forum_discussion_view() {
399389
// Checking that the event contains the expected values.
400390
$this->assertInstanceOf('\mod_hsuforum\event\discussion_viewed', $event);
401391
$this->assertEquals($context, $event->get_context());
402-
$expected = array($course->id, 'hsuforum', 'view discussion', "discuss.php?d={$discussion->id}",
403-
$discussion->id, $forum->cmid);
404-
$this->assertEventLegacyLogData($expected, $event);
405392
$this->assertEventContextNotUsed($event);
406393

407394
$this->assertNotEmpty($event->get_name());
@@ -1442,9 +1429,6 @@ public function test_hsuforum_discussion_view() {
14421429
// Checking that the event contains the expected values.
14431430
$this->assertInstanceOf('\mod_hsuforum\event\discussion_viewed', $event);
14441431
$this->assertEquals($context, $event->get_context());
1445-
$expected = array($course->id, 'hsuforum', 'view discussion', "discuss.php?d={$discussion->id}",
1446-
$discussion->id, $forum->cmid);
1447-
$this->assertEventLegacyLogData($expected, $event);
14481432
$this->assertEventContextNotUsed($event);
14491433

14501434
$this->assertNotEmpty($event->get_name());

0 commit comments

Comments
 (0)