LTI module data generator class.
More...
|
| get_type_and_config_from_data (array $data) |
| Split type creation data into 'type' and 'config' components, based on input array key prefixes.
|
|
| insert_files (stdClass $instance, stdClass $record, string $table, context $context, string $component, string $filearea, int $targetitemid) |
| Update the instance record, inserting any files that are referenced.
|
|
| post_add_instance ($id, $cmid) |
| Called after *_add_instance()
|
|
| precreate_course_module ($courseid, array $options) |
| Create course module and link it to course.
|
|
| prepare_moduleinfo_record ($record, $options) |
| Merges together arguments $record and $options and fills default module fields that are shared by all module types.
|
|
| set_user (?stdClass $user=null) |
| Set the current user during data generation.
|
|
|
testing_data_generator | $datagenerator |
|
int | $instancecount = 0 |
| number of created instances
|
|
LTI module data generator class.
- Copyright
- Copyright (c) 2012 Moodlerooms Inc. (http://www.moodlerooms.com)
- Author
- Mark Nielsen
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ create_content()
testing_module_generator::create_content |
( |
| $instance, |
|
|
| $record = array() ) |
|
inherited |
◆ create_course_tool_types()
mod_lti_generator::create_course_tool_types |
( |
array | $type | ) |
|
Create a course tool type.
- Parameters
-
- Return values
-
- Exceptions
-
◆ create_instance()
mod_lti_generator::create_instance |
( |
| $record = null, |
|
|
array | $options = null ) |
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.
- Parameters
-
array | stdClass | $record | data for module being generated. Requires 'course' key (an id or the full object). Also can have any fields from add module form. |
null | array | $options | general options for course module. Since 2.6 it is possible to omit this argument by merging options into $record |
- Return values
-
stdClass | record from module-defined table with additional field cmid (corresponding id in course_modules table) |
Reimplemented from testing_module_generator.
◆ create_tool_proxies()
mod_lti_generator::create_tool_proxies |
( |
array | $config | ) |
|
Create a tool proxy.
- Parameters
-
◆ create_tool_types()
mod_lti_generator::create_tool_types |
( |
array | $data | ) |
|
Create a tool type.
- Parameters
-
- Return values
-
◆ get_modulename()
testing_module_generator::get_modulename |
( |
| ) |
|
|
inherited |
Returns module name.
- Return values
-
string | name of module that this class describes |
- Exceptions
-
◆ get_type_and_config_from_data()
mod_lti_generator::get_type_and_config_from_data |
( |
array | $data | ) |
|
|
protected |
Split type creation data into 'type' and 'config' components, based on input array key prefixes.
The $data array contains both the type data and config data that will be passed to lti_add_type(). This must be split into two params (type, config) based on the array key prefixes ({
- See also
- lti_add_type()} for how the two params are handled):
- NO prefix: denotes 'type' data.
- 'lti_' prefix: denotes 'config' data.
- 'ltiservice_' prefix: denotes 'config' data, specifically config for service plugins.
- Parameters
-
array | $data | array of type and config data containing prefixed keys. |
- Return values
-
array | containing separated objects for type and config data. E.g. ['type' = stdClass, 'config' => stdClass] |
◆ insert_files()
component_generator_base::insert_files |
( |
stdClass | $instance, |
|
|
stdClass | $record, |
|
|
string | $table, |
|
|
context | $context, |
|
|
string | $component, |
|
|
string | $filearea, |
|
|
int | $targetitemid ) |
|
protectedinherited |
Update the instance record, inserting any files that are referenced.
- Parameters
-
stdClass | $instance | The instance record of the already-created record |
stdClass | $record | The data passed in to create the instance |
string | $table | The table that the data exists in |
context | $context | The context of the instance |
string | $component | The component of the owning plugin |
string | $filearea | The name of the file area |
int | $targetitemid | The itemid to use when saving the files |
- Return values
-
stdClass | The updated instance record |
◆ post_add_instance()
testing_module_generator::post_add_instance |
( |
| $id, |
|
|
| $cmid ) |
|
protectedinherited |
◆ precreate_course_module()
testing_module_generator::precreate_course_module |
( |
| $courseid, |
|
|
array | $options ) |
|
protectedinherited |
◆ prepare_moduleinfo_record()
testing_module_generator::prepare_moduleinfo_record |
( |
| $record, |
|
|
| $options ) |
|
protectedinherited |
Merges together arguments $record and $options and fills default module fields that are shared by all module types.
- Parameters
-
object | array | $record | fields (different from defaults) for this module |
null | array | $options | for backward-compatibility this may include fields from course_modules table. They are merged into $record |
- Exceptions
-
◆ reset()
testing_module_generator::reset |
( |
| ) |
|
|
inherited |
◆ set_user()
component_generator_base::set_user |
( |
?stdClass | $user = null | ) |
|
|
protectedinherited |
Set the current user during data generation.
This should be avoided wherever possible, but in some situations underlying code will insert data as the current user.
- Parameters
-
The documentation for this class was generated from the following file:
- mod/lti/tests/generator/lib.php