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

mod_h5pactivity grader tests

Copyright: 2020 Ferran Recio <ferran@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 360 lines (13 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: grader_test  - X-Ref

Grader tests class for mod_h5pactivity.

setupBeforeClass()   X-Ref
Setup to ensure that fixtures are loaded.


test_grade_item_delete()   X-Ref
Test for grade item delete.


test_grade_item_update(int $newgrade, bool $reset, string $idnumber)   X-Ref
Test for grade item update.

param: int $newgrade new activity grade
param: bool $reset if has to reset grades
param: string $idnumber the new idnumber

grade_item_update_data()   X-Ref
Data provider for test_grade_item_update.

return: array

test_update_grades(int $newgrade, bool $all, int $completion, array $results)   X-Ref
Test for grade update.

param: int $newgrade the new activity grade
param: bool $all if has to be applied to all students or just to one
param: int $completion 1 all student have the activity completed, 0 one have incompleted
param: array $results expected results (user1 grade, user2 grade)

update_grades_data()   X-Ref
Data provider for test_grade_item_update.

return: array

generate_fake_attempt(stdClass $activity, stdClass $user,int $rawscore, int $maxscore, int $completion = 1)   X-Ref
Create a fake attempt for a specific user.

param: stdClass $activity activity instance record.
param: stdClass $user user record
param: int $rawscore score obtained
param: int $maxscore attempt max score
param: int $completion 1 for activity completed, 0 for not completed yet
return: stdClass the attempt record