Make sure only site event and user event is returned as, the user doesnot have permissions on other events.
Make sure you get warnings for rest
Enrol the user in the course and group
Make call again with the same params and make sure you get 4 events (user, site, course, and group- one each)
Change options to where time() represents the time the events where created and weeksecs is the number of secs in a week. Alternatively browse the database and find out the timestamp for the second course event that was created and use any timestamp greater than that.
This is moderately difficult test, requires fair bit of time testing various logic flow paths.
Run unit tests and make sure all is good
Make sure the new calendar units tests are executed with the phpunit run. Check phpunit.xml and make sure there is an entry for calendar.
Setup a ws client of your choice. (/moodle/admin/settings.php?section=webservicesoverview might help)
User from now on refer's to an non-admin/managerial single user.
create 6 calendar events (1 site, 1 course with 2 childern(using repeat in new event form), 1 group event, 1 user event)
Goto event table in database using database browser of your choice and note the ids of each of them.
Lets say the ids are 1, 2-3-4,5,6 respectively
Assign a user the permission to make ws calls
Make a call with params like this (Assuming your are using xmlrpc client) :-
$events = array ('eventids' => array($siteevent->id), 'courseids' => array($course->id), 'groupids' => array($group->id));
$options = array ('siteevents' => true, 'userevents' => true);
Make sure only site event and user event is returned as, the user doesnot have permissions on other events.
Make sure you get warnings for rest
Enrol the user in the course and group
Make call again with the same params and make sure you get 4 events (user, site, course, and group- one each)
Change options to where time() represents the time the events where created and weeksecs is the number of secs in a week. Alternatively browse the database and find out the timestamp for the second course event that was created and use any timestamp greater than that.
$options = array ('siteevents' => true, 'userevents' => true, 'timeend' => time() + 7*WEEKSECS);
Make sure 5 events are returned (site, group, user -one each and 2 course events)
This is how you can pass params in xml-rpc client
$post = xmlrpc_encode_request($functionname, array( $events, $options));