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 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.

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

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.