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 unit test related to xAPI library.

Copyright: 2020 Ferran Recio
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 588 lines (22 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: statement_test  - X-Ref

Contains test cases for testing statement class.

get_valid_item(string $itemname)   X-Ref
Returns a valid item for a specific attribute.

param: string $itemname statement item name
return: item the resulting item

test_create(bool $useagent, array $extras, array $extravalues)   X-Ref
Test statement creation.

param: bool $useagent if use agent as actor (or group if false)
param: array $extras extra item elements
param: array $extravalues extra string values

create_provider()   X-Ref
Data provider for the test_create and test_create_from_data tests.

return: array

test_create_from_data(bool $useagent, array $extras, array $extravalues)   X-Ref
Test statement creation from xAPI statement data.

param: bool $useagent if use agent as actor (or group if false)
param: array $extras extra item elements
param: array $extravalues extra string values

test_add_attachment()   X-Ref
Test adding attachments to statement.


test_add_attachment_from_data()   X-Ref
Test adding attachments to statement.


test_invalid_gets(string $method, bool $exception)   X-Ref
Test all getters into a not set statement.

param: string $method the method to test
param: bool $exception if an exception is expected

invalid_gets_provider()   X-Ref
Data provider for the text_invalid_gets.

return: array

test_invalid_get_user()   X-Ref
Try to get a user from a group statement.


test_invalid_get_group()   X-Ref
Try to get a group from an agent statement.


test_invalid_get_activity_id()   X-Ref
Try to get activity Id from a statement with agent object.


test_invalid_data(bool $useuser, bool $userverb, bool $useobject)   X-Ref
Test for invalid structures.

param: bool $useuser if use user into statement
param: bool $userverb if use verb into statement
param: bool $useobject if use object into statement

invalid_data_provider()   X-Ref
Data provider for the test_invalid_data tests.

return: array

test_minify()   X-Ref
Test minify statement.