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

(no description)

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

Defines 1 class


Class: template_test  - X-Ref

Template tests class for mod_data.

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


test_parse_entries(string $templatecontent,string $expected,string $rolename = 'editingteacher',bool $enableexport = false,bool $approved = true,bool $enablecomments = false,bool $enableratings = false,array $options = [],bool $otherauthor = false)   X-Ref
Test for static create methods.

param: string $templatecontent the template string
param: string $expected expected output
param: string $rolename the user rolename
param: bool $enableexport is portfolio export is enabled
param: bool $approved if the entry is approved
param: bool $enablecomments is comments are enabled
param: bool $enableratings if ratings are enabled
param: array $options extra parser options
param: bool $otherauthor if the entry is from another user

parse_entries_provider()   X-Ref
Data provider for test_parse_entries().

return: array of scenarios

enable_portfolio(stdClass $user)   X-Ref
Create all the necessary data to enable portfolio export in mod_data

param: stdClass $user the current user record.

enable_ratings(context_module $context, stdClass $activity, array $entries, stdClass $user)   X-Ref
Enable the ratings on the database entries.

param: context_module $context the activity context
param: stdClass $activity the activity record
param: array $entries database entries
param: stdClass $user the current user record
return: stdClass the entries with the rating attribute

test_parse_add_entry(string $templatecontent,string $expected,bool $newentry = false)   X-Ref
Test parse add entry template parsing.

param: string $templatecontent the template string
param: string $expected expected output
param: bool $newentry if it is a new entry or editing and existing one

parse_add_entry_provider()   X-Ref
Data provider for test_parse_add_entry().

return: array of scenarios