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.

(no description)

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

Defines 1 class

customfield_test:: (7 methods):
  setup_custom_fields()
  setup_questions()
  backup_course()
  restore_course()
  test_create_question()
  test_delete_question()
  test_backup_restore()


Class: customfield_test  - X-Ref

Class qbank_customfields_customfield_testcase

setup_custom_fields()   X-Ref
Helper to assist with setting up custom fields.
This is creating custom field category and the fields, not adding instance field data.


setup_questions()   X-Ref
Helper to assist with setting up questions used in tests.


backup_course(\stdClass $course)   X-Ref
Makes a backup of the course.

param: \stdClass $course The course object.
return: string Unique identifier for this backup.

restore_course(string $backupid, string $fullname, string $shortname, int $categoryid)   X-Ref
Restores a backup that has been made earlier.

param: string $backupid The unique identifier of the backup.
param: string $fullname Full name of the new course that is going to be created.
param: string $shortname Short name of the new course that is going to be created.
param: int $categoryid The course category the backup is going to be restored in.
return: int The new course id.

test_create_question()   X-Ref
Test creating questions with custom fields.


test_delete_question()   X-Ref
Test deleting questions with custom fields.


test_backup_restore()   X-Ref
Test custom fields attached to questions persist
across the backup and restore process.