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.

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

(no description)

File Size: 919 lines (47 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 lib/grade/tests/fixtures/lib.php

Defines 1 class

grade_category_test:: (44 methods):
  test_grade_category()
  sub_test_grade_category_construct()
  sub_test_grade_category_build_path()
  sub_test_grade_category_fetch()
  sub_test_grade_category_fetch_all()
  sub_test_grade_category_update()
  sub_test_grade_category_delete()
  sub_test_grade_category_insert()
  sub_test_grade_category_qualifies_for_regrading()
  sub_test_grade_category_force_regrading()
  sub_test_grade_category_generate_grades_aggregationweight()
  sub_test_grade_category_generate_grades()
  helper_test_grade_agg_method()
  helper_test_grade_aggregation_result()
  sub_test_grade_category_aggregate_grades()
  sub_test_grade_category_apply_limit_rules()
  sub_test_grade_category_is_aggregationcoef_used()
  sub_test_grade_category_aggregation_uses_aggregationcoef()
  sub_test_grade_category_fetch_course_tree()
  sub_test_grade_category_get_children()
  sub_test_grade_category_load_grade_item()
  sub_test_grade_category_get_grade_item()
  sub_test_grade_category_load_parent_category()
  sub_test_grade_category_get_parent_category()
  sub_test_grade_category_get_name_escaped()
  sub_test_grade_category_get_name_unescaped()
  sub_test_grade_category_set_parent()
  sub_test_grade_category_get_final()
  sub_test_grade_category_get_sortorder()
  sub_test_grade_category_set_sortorder()
  sub_test_grade_category_move_after_sortorder()
  sub_test_grade_category_is_course_category()
  sub_test_grade_category_fetch_course_category()
  sub_test_grade_category_is_editable()
  sub_test_grade_category_is_locked()
  sub_test_grade_category_set_locked()
  sub_test_grade_category_is_hidden()
  sub_test_grade_category_set_hidden()
  sub_test_grade_category_can_control_visibility()
  sub_test_grade_category_insert_course_category()
  generate_random_raw_grade()
  sub_test_grade_category_is_extracredit_used()
  sub_test_grade_category_aggregation_uses_extracredit()
  sub_test_grade_category_total_visibility()


Class: grade_category_test  - X-Ref

Test grade categories

test_grade_category()   X-Ref
No description

sub_test_grade_category_construct()   X-Ref
No description

sub_test_grade_category_build_path()   X-Ref
No description

sub_test_grade_category_fetch()   X-Ref
No description

sub_test_grade_category_fetch_all()   X-Ref
No description

sub_test_grade_category_update()   X-Ref
No description

sub_test_grade_category_delete()   X-Ref
No description

sub_test_grade_category_insert()   X-Ref
No description

sub_test_grade_category_qualifies_for_regrading()   X-Ref
No description

sub_test_grade_category_force_regrading()   X-Ref
No description

sub_test_grade_category_generate_grades_aggregationweight()   X-Ref
Tests the setting of the grade_grades aggregationweight column.
Currently, this is only a regression test for MDL-51715.
This must be run before sub_test_grade_category_set_parent(), which alters
the fixture.


sub_test_grade_category_generate_grades()   X-Ref
Tests the calculation of grades using the various aggregation methods with and without hidden grades
This will not work entirely until MDL-11837 is done


helper_test_grade_agg_method($grade_category, $grade_items, $grade_grades, $aggmethod, $aggmethodname, $correct1, $correct2)   X-Ref
Test grade category aggregation using the supplied grade objects and aggregation method

param: grade_category $grade_category the category to be tested
param: array $grade_items array of instance of grade_item
param: array $grade_grades array of instances of grade_grade
param: int $aggmethod the aggregation method to apply ie GRADE_AGGREGATE_MEAN
param: string $aggmethodname the name of the aggregation method to apply. Used to display any test failure messages
param: int $correct1 the correct final grade for the category with NO items hidden
param: int $correct2 the correct final grade for the category with the grade at $grade_grades[0] hidden
return: void

helper_test_grade_aggregation_result($grade_category, $correctgrade, $msg)   X-Ref
Verify the value of the category grade item for $this->userid

param: grade_category $grade_category the category to be tested
param: int $correctgrade the expected grade
param: string msg The message that should be displayed if the correct grade is not found
return: void

sub_test_grade_category_aggregate_grades()   X-Ref
No description

sub_test_grade_category_apply_limit_rules()   X-Ref
No description

sub_test_grade_category_is_aggregationcoef_used()   X-Ref
No description

sub_test_grade_category_aggregation_uses_aggregationcoef()   X-Ref
No description

sub_test_grade_category_fetch_course_tree()   X-Ref
No description

sub_test_grade_category_get_children()   X-Ref
No description

sub_test_grade_category_load_grade_item()   X-Ref
No description

sub_test_grade_category_get_grade_item()   X-Ref
No description

sub_test_grade_category_load_parent_category()   X-Ref
No description

sub_test_grade_category_get_parent_category()   X-Ref
No description

sub_test_grade_category_get_name_escaped()   X-Ref
Tests the getter of the category fullname with escaped HTML.


sub_test_grade_category_get_name_unescaped()   X-Ref
Tests the getter of the category fullname with unescaped HTML.


sub_test_grade_category_set_parent()   X-Ref
No description

sub_test_grade_category_get_final()   X-Ref
No description

sub_test_grade_category_get_sortorder()   X-Ref
No description

sub_test_grade_category_set_sortorder()   X-Ref
No description

sub_test_grade_category_move_after_sortorder()   X-Ref
No description

sub_test_grade_category_is_course_category()   X-Ref
No description

sub_test_grade_category_fetch_course_category()   X-Ref
No description

sub_test_grade_category_is_editable()   X-Ref
TODO implement


sub_test_grade_category_is_locked()   X-Ref
No description

sub_test_grade_category_set_locked()   X-Ref
No description

sub_test_grade_category_is_hidden()   X-Ref
No description

sub_test_grade_category_set_hidden()   X-Ref
No description

sub_test_grade_category_can_control_visibility()   X-Ref
No description

sub_test_grade_category_insert_course_category()   X-Ref
No description

generate_random_raw_grade($item, $userid)   X-Ref
No description

sub_test_grade_category_is_extracredit_used()   X-Ref
No description

sub_test_grade_category_aggregation_uses_extracredit()   X-Ref
No description

sub_test_grade_category_total_visibility()   X-Ref
Test for category total visibility.