Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

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

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: 4 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