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] [Versions 400 and 401]

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.