Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403] [Versions 39 and 310]

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.

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

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

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

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

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

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

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

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

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