Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 39 and 400]

This file contains helper classes and functions for testing.

Copyright: 2017 Ryan Wyllie <ryan@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 256 lines (9 kb)
Included or required: 5 times
Referenced: 2 times
Includes or requires: 0 files

Defines 1 class

action_event_test_factory:: (2 methods):
  __construct()
  create_instance()

Defines 2 functions


Class: action_event_test_factory  - X-Ref

A test factory that will create action events.

__construct($callback = null)   X-Ref
A test factory that will create action events. The factory accepts a callback
that will be used to determine if the event should be returned or not.

The callback will be given the event and should return true if the event
should be returned and false otherwise.

param: callable $callback The callback.

create_instance(\stdClass $record)   X-Ref
No description

Functions that are not part of a class:

create_event($properties)   X-Ref
Create a calendar event with the given properties.

return: \calendar_event
param: array $properties The properties to set on the event

create_standard_events(int $quantity)   X-Ref
Helper function to create a x number of events for each event type.

return: array List of created events.
param: int $quantity The quantity of events to be created.

create_action_event(array $data)   X-Ref
Helper function to create an action event.

return: bool|calendar_event
param: array $data The event data.

create_user_override_event(string $modulename, int $instanceid, int $userid)   X-Ref
Helper function to create an user override calendar event.

return: calendar_event|false
param: string $modulename The modulename.
param: int $instanceid The instance id.
param: int $userid The user id.

create_group_override_event(string $modulename, int $instanceid, int $courseid, int $groupid)   X-Ref
Helper function to create an group override calendar event.

return: calendar_event|false
param: string $modulename The modulename.
param: int $instanceid The instance id.
param: int $courseid The course id.
param: int $groupid The group id.