Search moodle.org's
Developer Documentation

See Release Notes

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

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402]

Unit tests for grade/lib.php.

Copyright: 2016 Jun Pataleta
License: http://www.gnu.org/copyleft/gpl.html GNU Public License
File Size: 777 lines (35 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: lib_test  - X-Ref

Unit tests for grade/lib.php.

test_can_output_item()   X-Ref
Test can_output_item.


test_ungraded_counts_count_sumgrades()   X-Ref
Tests that ungraded_counts calculates count and sum of grades correctly when there are graded users.


test_ungraded_count_sumgrades_groups()   X-Ref
Tests that ungraded_counts calculates count and sum of grades correctly for groups when there are graded users.


test_calculate_average(int $meanselection, array $expectedmeancount, array $expectedaverage)   X-Ref
Tests for calculate_average.

param: int $meanselection Whether to inlcude all grades or non-empty grades in aggregation.
param: array $expectedmeancount expected meancount value
param: array $expectedaverage expceted average value

calculate_average_data()   X-Ref
Data provider for test_calculate_average

return: array of testing scenarios

test_item_types()   X-Ref
Tests for item types.


test_get_gradable_users()   X-Ref
Test get_gradable_users() function.