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 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

Unit tests helper for xAPI library. This file contains unit test helpers related to xAPI library.

Copyright: 2020 Ferran Recio
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 118 lines (4 kb)
Included or required:0 times
Referenced: 11 times
Includes or requires: 2 files
 lib/xapi/tests/fixtures/handler.php
 lib/xapi/tests/fixtures/xapi_test_statement_post.php

Defines 1 class

test_helper:: (3 methods):
  init_log()
  get_last_log_entry()
  create_state()


Class: test_helper  - X-Ref

Contains helper functions for xAPI PHPUnit Tests.

init_log()   X-Ref
Constructor for a xAPI test helper.


get_last_log_entry()   X-Ref
Return the last log entry from standardlog.

return: \core\event\base|null The last log event or null if none found.

create_state(array $info = [], bool $createindatabase = false)   X-Ref
Return a valid state object with the params passed.

All tests are based on craft different types of states. This function
is made to prevent redundant code on the test.

param: array $info array of overriden state data (default []).
param: bool $createindatabase Whether the state object should be created in database too or not.
return: state the resulting state