Data generator the admin_presets tool.  
 More...
|  | 
|  | access_protected ($object, string $property) | 
|  | Helper method to access to a protected property. 
 | 
|  | 
|  | create_preset (array $data=[]) | 
|  | Create a preset. 
 | 
|  | 
|  | get_admin_preset_setting (string $category, string $settingname) | 
|  | Given a tree category and setting name, it gets the adminpresets_setting class. 
 | 
|  | 
|  | reset () | 
|  | To be called from data reset code only, do not use in tests. 
 | 
|  | 
|  | 
|  | 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. 
 | 
|  | 
|  | 
| testing_data_generator | $datagenerator | 
|  | 
Data generator the admin_presets tool. 
- Copyright
- 2021 Sara Arjona (sara@.nosp@m.mood.nosp@m.le.co.nosp@m.m) 
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
◆ access_protected()
  
  | 
        
          | core_adminpresets_generator::access_protected | ( |  | $object, |  
          |  |  | string | $property ) |  | inherited | 
 
Helper method to access to a protected property. 
- Parameters
- 
  
    | string | object | $object | The class. |  | string | $property | The private/protected property in $object to access. |  
 
- Return values
- 
  
    | mixed | The current value of the property. |  
 
 
 
◆ create_preset()
  
  | 
        
          | core_adminpresets_generator::create_preset | ( | array | $data = [] | ) |  |  | inherited | 
 
Create a preset. 
This preset will have only 3 settings and 3 plugins. Settings:
- none.enablebadges = 0
- none.allowemojipicker = 1
- mod_lesson.mediawidth = 900
- mod_lesson.maxanswers = 2 with advanced disabled. Plugins:
enrol_guest = 0
- Parameters
- 
  
    | array | $data | Preset data. Supported values: 
name. To define the preset name.comments. To change the comments field.author. To set the author.applypreset. Whether the preset should be applied too or not.  |  
 
- Return values
- 
  
    | int | Identifier of the preset created. |  
 
 
 
◆ get_admin_preset_setting()
  
  | 
        
          | core_adminpresets_generator::get_admin_preset_setting | ( | string | $category, |  
          |  |  | string | $settingname ) |  | inherited | 
 
Given a tree category and setting name, it gets the adminpresets_setting class. 
- Parameters
- 
  
    | string | $category | Tree category name where the setting is located. |  | string | $settingname | Setting name to get the class. |  
 
- Return values
- 
  
  
 
 
◆ 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 |  
 
 
 
◆ reset()
  
  | 
        
          | component_generator_base::reset | ( |  | ) |  |  | inherited | 
 
To be called from data reset code only, do not use in tests. 
- Return values
- 
  
  
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.
 
 
◆ 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:
- admin/tool/admin_presets/tests/generator/lib.php