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.

For use in unit tests that require an info module which isn't really used.

Copyright: 2019 Ferran Recio
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 115 lines (3 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

mock_info_module:: (7 methods):
  __construct()
  get_thing_name()
  get_context()
  get_view_hidden_capability()
  set_in_database()
  get_modinfo()
  set_cm()


Class: mock_info_module  - X-Ref

For use in unit tests that require an info module which isn't really used.

__construct($userid = 0, \cm_info $cm = null)   X-Ref
Constructs with item details.

param: int $userid Userid for modinfo (if used)
param: \cm_info $cm Course-module object

get_thing_name()   X-Ref
Just returns a mock name.

return: string Name of item

get_context()   X-Ref
Returns the current context.

return: \context Context for this item

get_view_hidden_capability()   X-Ref
Returns the cappability used to ignore access restrictions.

return: string Name of capability used to view hidden items of this type

set_in_database($availability)   X-Ref
Mocks don't need to save anything into DB.

param: string $availability New JSON value

get_modinfo()   X-Ref
Obtains the modinfo associated with this availability information.

Note: This field is available ONLY for use by conditions when calculating
availability or information.

return: \course_modinfo Modinfo

set_cm(\cm_info $cm)   X-Ref
Override course-module info.

param: \cm_info $cm