|
Moodle PHP Documentation 4.1
Moodle 4.1.19+ (Build: 20250711) (5f47dc23ffc)
|
Component generator base class. More...
Public Member Functions | |
| __construct (testing_data_generator $datagenerator) | |
| Constructor. | |
| reset () | |
| To be called from data reset code only, do not use in tests. | |
Protected Member Functions | |
| 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. | |
| set_user (?stdClass $user=null) | |
| Set the current user during data generation. | |
Protected Attributes | |
| testing_data_generator | $datagenerator |
Component generator base class.
Extend in path/to/component/tests/generator/lib.php as class type_plugin_generator extends component_generator_base Note that there are more specific classes to extend for mods and blocks.
| component_generator_base::__construct | ( | testing_data_generator | $datagenerator | ) |
Constructor.
| testing_data_generator | $datagenerator |
|
protected |
Update the instance record, inserting any files that are referenced.
| 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 |
| stdClass | The updated instance record |
| component_generator_base::reset | ( | ) |
To be called from data reset code only, do not use in tests.
| void |
Reimplemented in core_competency_generator, core_notes_generator, core_question_generator, mod_book_generator, mod_chat_generator, mod_data_generator, mod_forum_generator, mod_glossary_generator, mod_lesson_generator, mod_survey_generator, mod_wiki_generator, testing_block_generator, testing_module_generator, testing_repository_generator, and tool_dataprivacy_generator.
|
protected |
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.
| stdClass | $user |