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 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

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_testcase  - 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