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

Unit tests for mod_lti gradebookservices

Copyright: 2020 Claude Vervoort <claude.vervoort@cengage.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 292 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: mod_lti_gradebookservices_testcase  - X-Ref

Unit tests for lti gradebookservices.

test_lti_add_coupled_lineitem()   X-Ref
Test saving a graded LTI with resource and tag info (as a result of
content item selection) creates a gradebookservices record
that can be retrieved using the gradebook service API.


test_lti_add_standalone_lineitem()   X-Ref
Test saving a standalone LTI lineitem with resource and tag info
that can be retrieved using the gradebook service API.


test_get_launch_parameters_coupled()   X-Ref
Test line item URL is populated for coupled line item only
if there is not another line item bound to the lti instance,
since in that case there would be no rule to define which of
the line items should be actually passed.


test_get_launch_parameters_decoupled()   X-Ref
Test line item URL is populated for not coupled line item only
if there is a single line item attached to that lti instance.


test_is_user_gradable_in_course()   X-Ref
Test if a user can be graded in a course.


assert_lineitems(object $course, int $typeid,string $label, ?object $ltiinstance, ?string $resourceid, ?string $tag)   X-Ref
Asserts a matching gradebookservices record exist with the matching tag and resourceid.

param: object $course current course
param: int $typeid Type id of the tool
param: string $label Label of the line item
param: object|null $ltiinstance lti instance related to that line item
param: string|null $resourceid resourceid the line item should have
param: string|null $tag tag the line item should have

create_graded_lti(int $typeid, object $course, ?string $resourceid, ?string $tag)   X-Ref
Inserts a graded lti instance, which should create a grade_item and gradebookservices record.

param: int $typeid Type ID of the LTI Tool.
param: object $course course where to add the lti instance.
param: string|null $resourceid resource id
param: string|null $tag tag
return: object lti instance created

create_notgraded_lti(int $typeid, object $course)   X-Ref
Inserts an lti instance that is not graded.

param: int $typeid Type Id of the LTI Tool.
param: object $course course where to add the lti instance.
return: object lti instance created

create_standalone_lineitem(int $courseid, int $typeid, ?string $resourceid,?string $tag, int $ltiinstanceid = null)   X-Ref
Inserts a standalone lineitem (gradeitem, gradebookservices entries).

param: int $courseid Id of the course where the standalone line item will be added.
param: int $typeid of the LTI Tool
param: string|null $resourceid resource id
param: string|null $tag tag
param: int|null $ltiinstanceid Id of the LTI instance the standalone line item will be related to.

create_type()   X-Ref
Creates a new LTI Tool Type.