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 39 and 310]

Unit tests for the grade API at /lib/classes/grades_external.php

Copyright: 2012 Andrew Davis
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 616 lines (25 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

core_grades_external_testcase:: (8 methods):
  load_test_data()
  test_get_grades()
  get_activity()
  get_activity_student_grade()
  get_outcome()
  get_outcome_student_grade()
  test_update_grades()
  test_create_gradecategory()


Class: core_grades_external_testcase  - X-Ref

Grades functions unit tests

load_test_data($assignmentname, $student1rawgrade, $student2rawgrade)   X-Ref
Load initial test information

param: string $assignmentname   Assignment name
param: int $student1rawgrade    Student 1 grade
param: int $student2rawgrade    Student 2 grade
return: array                    Array of vars with test information

test_get_grades()   X-Ref
Test get_grades()


get_activity($grades, $cmid)   X-Ref
Get an activity

param: array $grades    Array of grades
param: int $cmid        Activity course module id
return: strdClass        Activity object

get_activity_student_grade($grades, $cmid, $studentid)   X-Ref
Get a grade for an activity

param: array $grades    Array of grades
param: int $cmid        Activity course module id
param: int $studentid   Student it
return: stdClass         Activity Object

get_outcome($grades, $cmid)   X-Ref
Get an ouctome

param: array $grades    Array of grades
param: int $cmid        Activity course module id
return: stdClass         Outcome object

get_outcome_student_grade($grades, $cmid, $studentid)   X-Ref
Get a grade from an outcome

param: array $grades    Array of grades
param: int $cmid        Activity course module id
param: int $studentid   Student id
return: stdClass         Outcome object

test_update_grades()   X-Ref
Test update_grades()


test_create_gradecategory()   X-Ref
Test create_gradecategory.

return: void