Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Class: step_test  - X-Ref

Tests for step.

setUp()   X-Ref
Setup to store the DB reference.


tearDown()   X-Ref
Tear down to restore the original DB reference.


mock_database()   X-Ref
Helper to mock the database.

return: moodle_database

dirty_value_provider()   X-Ref
Data provider for the dirty value tester.

return: array

test_fetch()   X-Ref
Test the fetch function.


test_dirty_values($name, $value)   X-Ref
Test that setters mark things as dirty.

param: string  $name       The key to update
param: string  $value      The value to set

step_sortorder_provider()   X-Ref
Provider for is_first_step.

return: array

test_is_first_step($sortorder, $count, $isfirst, $islast)   X-Ref
Test is_first_step.

param: int     $sortorder      The sortorder to check
param: int     $count          Unused in this function
param: bool    $isfirst        Whether this is the first step
param: bool    $islast         Whether this is the last step

test_is_last_step($sortorder, $count, $isfirst, $islast)   X-Ref
Test is_last_step.

param: int     $sortorder      The sortorder to check
param: int     $count          Total number of steps for this test
param: bool    $isfirst        Whether this is the first step
param: bool    $islast         Whether this is the last step

test_get_config_no_keys()   X-Ref
Test get_config with no keys provided.


get_config_provider()   X-Ref
Data provider for get_config.

return: array

test_get_config_valid_keys($values, $key, $default, $tourconfig, $isforced, $forcedvalue, $expected)   X-Ref
Test get_config with valid keys provided.

param: object  $values     The config values
param: string  $key        The key
param: mixed   $default    The default value
param: mixed   $tourconfig The tour config
param: bool    $isforced   Whether the setting is forced
param: mixed   $forcedvalue    The example value
param: mixed   $expected   The expected value

set_config_provider()   X-Ref
Data provider for set_config.


test_set_config($initialvalues, $key, $newvalue, $expected)   X-Ref
Test that set_config works in the anticipated fashion.

param: mixed   $initialvalues  The inital value to set
param: string  $key        The key to test
param: mixed   $newvalue   The new value to set
param: mixed   $expected   The expected value

test_persist_non_dirty()   X-Ref
Ensure that non-dirty tours are not persisted.


test_persist_dirty_new()   X-Ref
Ensure that new dirty steps are persisted.


test_persist_force_new()   X-Ref
Ensure that new non-dirty, forced steps are persisted.


test_persist_dirty_existing()   X-Ref
Ensure that existing dirty steps are persisted.


test_persist_force_existing()   X-Ref
Ensure that existing non-dirty, forced steps are persisted.


test_remove_non_persisted()   X-Ref
Check that a tour which has never been persisted is removed correctly.


test_remove_persisted()   X-Ref
Check that a tour which has been persisted is removed correctly.


getter_provider()   X-Ref
Data provider for the get_ tests.

return: array

test_getters($key, $value)   X-Ref
Test that getters return the configured value.

param: string  $key        The key to test
param: mixed   $value      The expected value

get_string_from_input_provider()   X-Ref
Data Provider for get_string_from_input.

return: array

test_get_string_from_input($string, $expected)   X-Ref
Ensure that the get_string_from_input function returns langstring strings correctly.

param: string  $string     The string to test
param: string  $expected   The expected result