Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Unit tests for the progress classes.

Copyright: 2013 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 427 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

core_progress_testcase:: (8 methods):
  test_basic()
  test_nested()
  test_nested_weighted()
  test_realistic()
  test_zero()
  test_exceptions()
  test_progress_change()
  assert_min_max()

core_mock_progress:: (4 methods):
  was_update_called()
  step_time()
  update_progress()
  get_time()


Class: core_progress_testcase  - X-Ref

Progress tests.

test_basic()   X-Ref
Tests for basic use with simple numeric progress.


test_nested()   X-Ref
Tests progress that is nested and/or indeterminate.


test_nested_weighted()   X-Ref
Tests the feature for 'weighting' nested progress.


test_realistic()   X-Ref
I had some issues with real use in backup/restore, this test is intended
to be similar.


test_zero()   X-Ref
To avoid causing problems, progress needs to work for sections that have
zero entries.


test_exceptions()   X-Ref
Tests for any exceptions due to invalid calls.


test_progress_change()   X-Ref
No description

assert_min_max($min, $max, core_mock_progress $progress)   X-Ref
Checks the current progress values are as expected.

param: number $min Expected min progress
param: number $max Expected max progress
param: core_mock_progress $progress

Class: core_mock_progress  - X-Ref

Helper class that records when update_progress is called and allows time
stepping.

was_update_called()   X-Ref
Checks if update was called since the last call to this function.

return: boolean True if update was called

step_time()   X-Ref
Steps the current time by 1 second.


update_progress()   X-Ref
No description

get_time()   X-Ref
No description