Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
block_online_users_generator Class Reference
Inheritance diagram for block_online_users_generator:
testing_block_generator component_generator_base

Public Member Functions

 create_instance ($record=null, $options=array())
 Create a test block instance. More...
 
 create_logged_in_users ()
 Create (simulated) logged in users and add some of them to groups in a course.
 
 get_blockname ()
 Returns block name. More...
 
 reset ()
 To be called from data reset code only, do not use in tests. More...
 

Protected Member Functions

 prepare_record (stdClass $record)
 Fill in record defaults. More...
 
 preprocess_record (stdClass $record, array $options)
 Can be overridden to do block-specific processing. More...
 

Protected Attributes

testing_data_generator $datagenerator
 
number $instancecount = 0
 of created instances
 

Member Function Documentation

◆ create_instance()

testing_block_generator::create_instance (   $record = null,
  $options = array() 
)
inherited

Create a test block instance.

The $record passed in becomes the basis for the new row added to the block_instances table. You only need to supply the values of interest. Any missing values have sensible defaults filled in.

The $options array provides additional data, not directly related to what will be inserted in the block_instance table, which may affect the block that is created. The meanings of any data passed here depends on the particular type of block being created.

Parameters
array | stdClass$recordforms the basis for the entry to be inserted in the block_instances table.
array$optionsfurther, block-specific options to control how the block is created.
Return values
stdClassthe block_instance record that has just been created.

◆ get_blockname()

testing_block_generator::get_blockname ( )
inherited

Returns block name.

Return values
stringname of block that this class describes
Exceptions
coding_exceptionif class invalid

◆ prepare_record()

testing_block_generator::prepare_record ( stdClass  $record)
protectedinherited

Fill in record defaults.

Parameters
stdClass$record
Return values
stdClass

◆ preprocess_record()

testing_block_generator::preprocess_record ( stdClass  $record,
array  $options 
)
protectedinherited

Can be overridden to do block-specific processing.

$record can be modified in-place.

Parameters
stdClass$recordthe data, before defaults are filled in.
array$optionsfurther, block-specific options, as passed to create_instance().

◆ reset()

testing_block_generator::reset ( )
inherited

To be called from data reset code only, do not use in tests.

Return values
void

Reimplemented from component_generator_base.


The documentation for this class was generated from the following file: