[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/testing/generator/ -> module_generator.php (summary)

Module generator base class.

Copyright: 2012 Petr Skoda {@link http://skodak.org}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 285 lines (11 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 7 functions

  reset()
  get_modulename()
  precreate_course_module()
  post_add_instance()
  prepare_moduleinfo_record()
  create_instance()
  create_content()

Functions
Functions that are not part of a class:

reset()   X-Ref
To be called from data reset code only,
do not use in tests.

return: void

get_modulename()   X-Ref
Returns module name

return: string name of module that this class describes

precreate_course_module($courseid, array $options)   X-Ref
Create course module and link it to course

Since 2.6 it is recommended to use function add_moduleinfo() to create a module.

param: integer $courseid
param: array $options section, visible
return: integer $cm instance id

post_add_instance($id, $cmid)   X-Ref
Called after *_add_instance()

Since 2.6 it is recommended to use function add_moduleinfo() to create a module.

param: int $id
param: int $cmid
return: stdClass module instance

prepare_moduleinfo_record($record, $options)   X-Ref
Merges together arguments $record and $options and fills default module
fields that are shared by all module types

param: object|array $record fields (different from defaults) for this module
param: null|array $options for backward-compatibility this may include fields from course_modules

create_instance($record = null, array $options = null)   X-Ref
Creates an instance of the module for testing purposes.

Module type will be taken from the class name. Each module type may overwrite
this function to add other default values used by it.

param: array|stdClass $record data for module being generated. Requires 'course' key
param: null|array $options general options for course module. Since 2.6 it is
return: stdClass record from module-defined table with additional field

create_content($instance, $record = array()   X-Ref
Generates a piece of content for the module.
User is usually taken from global $USER variable.

param: stdClass $instance object returned from create_instance() call
param: stdClass|array $record
return: stdClass generated object



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1