Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

(no description)

File Size: 290 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: gradebookservices_test  - 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.

return: object lti instance created
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

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

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

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.