Search moodle.org's
Developer Documentation

See Release Notes

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

(no description)

File Size: 397 lines (13 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes


Class: get_states_test  - X-Ref

Unit tests for xAPI get states webservice.

setUpBeforeClass()   X-Ref
Setup to ensure that fixtures are loaded.


execute_service(string $component,state $data,?string $since = null,array $override = [])   X-Ref
Execute the get_states service from a generate state.

param: string $component component name
param: state $data the original state to extract the params
param: string|null $since the formated timestamp or ISO 8601 date
param: array $override overridden params
return: string[] array of state ids

get_external_class()   X-Ref
Return a xAPI external webservice class to operate.

The test needs to fake a component in order to test without
using a real one. This way if in the future any component
implement it's xAPI handler this test will continue working.

return: get_states the external class

Class: extends  - X-Ref

validate_component(string $component)   X-Ref
Method to override validate_component.

param: string $component  The component name in frankenstyle.

test_component_names(string $component, ?bool $exception)   X-Ref
Testing different component names on valid states.

param: string $component component name
param: string|null $exception expect exception

components_provider()   X-Ref
Data provider for the test_component_names tests.

return: array

test_since_formats(?string $since, ?array $expected, bool $exception = false)   X-Ref
Testing different since date formats.

param: string|null $since the formatted timestamps
param: string[]|null $expected expected results
param: bool $exception expect exception

since_formats_provider()   X-Ref
Data provider for the test_since_formats tests.

return: array

test_activity_iri(?string $activityiri, ?array $expected)   X-Ref
Testing different activity IRI values.

param: string|null $activityiri
param: string[]|null $expected expected results

activity_iri_provider()   X-Ref
Data provider for the test_activity_iri tests.

return: array

test_agent_values(?string $agentreference, ?array $expected, bool $exception = false)   X-Ref
Testing different agent values.

param: string|null $agentreference the used agent reference
param: string[]|null $expected expected results
param: bool $exception expect exception

agent_values_provider()   X-Ref
Data provider for the test_agent_values tests.

return: array

test_registration_values(?string $registration, ?array $expected)   X-Ref
Testing different registration values.

param: string|null $registration
param: string[]|null $expected expected results

registration_values_provider()   X-Ref
Data provider for the test_registration_values tests.

return: array

generate_states()   X-Ref
Generate the state for the testing scenarios.

Generate a variaty of states from several components, registrations and state ids.
Some of the states are registered as they are done in 27-04-2022 07:00:00 while others
are updated in 28-04-2022 07:00:00.

return: state[]