Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]

(no description)

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

Defines 1 class


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

test_get_step_image_from_input()   X-Ref
Ensure that the get_step_image_from_input function replace PIXICON placeholder with the correct images correctly.