Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
testable_question_engine_unit_of_work Class Reference

Test subclass to allow access to some protected data so that the correct behaviour can be verified. More...

Inheritance diagram for testable_question_engine_unit_of_work:
question_engine_unit_of_work question_usage_observer

Public Member Functions

 get_attempts_added ()
 
 get_attempts_modified ()
 
 get_metadata_added ()
 
 get_metadata_modified ()
 
 get_modified ()
 
 get_steps_added ()
 
 get_steps_deleted ()
 
 get_steps_modified ()
 
 notify_attempt_added (question_attempt $qa)
 Called when a new question attempt is added to this usage.
 
 notify_attempt_modified (question_attempt $qa)
 Called when the fields of a question attempt in this usage are modified.
 
 notify_attempt_moved (question_attempt $qa, $oldslot)
 Called when a question_attempt has been moved to a new slot.
 
 notify_metadata_added (question_attempt $qa, $name)
 Called when a new metadata variable is set on a question attempt in this usage.
 
 notify_metadata_modified (question_attempt $qa, $name)
 Called when a metadata variable on a question attempt in this usage is updated.
 
 notify_modified ()
 Called when a field of the question_usage_by_activity is changed.
 
 notify_step_added (question_attempt_step $step, question_attempt $qa, $seq)
 Called when a new step is added to a question attempt in this usage.
 
 notify_step_deleted (question_attempt_step $step, question_attempt $qa)
 Called when a new step is updated in a question attempt in this usage.
 
 notify_step_modified (question_attempt_step $step, question_attempt $qa, $seq)
 Called when a new step is updated in a question attempt in this usage.
 
 save (question_engine_data_mapper $dm)
 Write all the changes we have recorded to the database.
 

Protected Member Functions

 is_step_added (question_attempt_step $step)
 Determine if a step is new.
 
 is_step_deleted (question_attempt_step $step)
 
 is_step_modified (question_attempt_step $step)
 Determine if a step is modified.
 

Protected Attributes

question_attempt[] $attemptsadded = array()
 list of slot => that have been added to the usage.
 
question_attempt[] $attemptsdeleted = array()
 list of slot => that have been added to the usage.
 
question_attempt[] $attemptsmodified = array()
 list of slot => that were already in the usage, and which have been modified.
 
array $metadataadded = array()
 int slot => string name => question_attempt.
 
array $metadatamodified = array()
 int slot => string name => question_attempt.
 
boolean $modified = false
 whether any of the fields of the usage have been changed.
 
question_usage_by_activity $quba
 the usage being tracked.
 
array $stepsadded = array()
 of array(question_attempt_step, question_attempt id, seq number) of steps that have been added to question attempts in this usage.
 
question_attempt_step[] $stepsdeleted = array()
 list of question_attempt_step.id => question_attempt_step of steps that were previously stored in the database, but which are no longer required.
 
array $stepsmodified = array()
 of array(question_attempt_step, question_attempt id, seq number) of steps that have been modified in their attempt.
 

Detailed Description

Test subclass to allow access to some protected data so that the correct behaviour can be verified.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ is_step_added()

question_engine_unit_of_work::is_step_added ( question_attempt_step $step)
protectedinherited

Determine if a step is new.

If so get its array key.

Parameters
question_attempt_step$stepa step
Return values
int|falseif the step is in the list of steps to be added, return the key, otherwise return false.

◆ is_step_deleted()

question_engine_unit_of_work::is_step_deleted ( question_attempt_step $step)
protectedinherited
Parameters
question_attempt_step$stepa step
Return values
boolwhether the step is in the list of steps to be deleted.

◆ is_step_modified()

question_engine_unit_of_work::is_step_modified ( question_attempt_step $step)
protectedinherited

Determine if a step is modified.

If so get its array key.

Parameters
question_attempt_step$stepa step
Return values
int|falseif the step is in the list of steps to be modified, return the key, otherwise return false.

◆ notify_attempt_added()

question_engine_unit_of_work::notify_attempt_added ( question_attempt $qa)
inherited

Called when a new question attempt is added to this usage.

Parameters
question_attempt$qathe newly added question attempt.

Implements question_usage_observer.

◆ notify_attempt_modified()

question_engine_unit_of_work::notify_attempt_modified ( question_attempt $qa)
inherited

Called when the fields of a question attempt in this usage are modified.

Parameters
question_attempt$qathe newly added question attempt.

Implements question_usage_observer.

◆ notify_attempt_moved()

question_engine_unit_of_work::notify_attempt_moved ( question_attempt $qa,
$oldslot )
inherited

Called when a question_attempt has been moved to a new slot.

Parameters
question_attempt$qaThe question attempt that was moved.
int$oldslotThe previous slot number of that attempt.

Implements question_usage_observer.

◆ notify_metadata_added()

question_engine_unit_of_work::notify_metadata_added ( question_attempt $qa,
$name )
inherited

Called when a new metadata variable is set on a question attempt in this usage.

Parameters
question_attempt$qathe question attempt the metadata is being added to.
int$namethe name of the metadata variable added.

Implements question_usage_observer.

◆ notify_metadata_modified()

question_engine_unit_of_work::notify_metadata_modified ( question_attempt $qa,
$name )
inherited

Called when a metadata variable on a question attempt in this usage is updated.

Parameters
question_attempt$qathe question attempt where the metadata is being modified.
int$namethe name of the metadata variable modified.

Implements question_usage_observer.

◆ notify_modified()

question_engine_unit_of_work::notify_modified ( )
inherited

Called when a field of the question_usage_by_activity is changed.

Implements question_usage_observer.

◆ notify_step_added()

question_engine_unit_of_work::notify_step_added ( question_attempt_step $step,
question_attempt $qa,
$seq )
inherited

Called when a new step is added to a question attempt in this usage.

Parameters
question_attempt_step$stepthe new step.
question_attempt$qathe usage it is being added to.
int$seqthe sequence number of the new step.

Implements question_usage_observer.

◆ notify_step_deleted()

question_engine_unit_of_work::notify_step_deleted ( question_attempt_step $step,
question_attempt $qa )
inherited

Called when a new step is updated in a question attempt in this usage.

Parameters
question_attempt_step$stepthe step to delete.
question_attempt$qathe usage it is being added to.

Implements question_usage_observer.

◆ notify_step_modified()

question_engine_unit_of_work::notify_step_modified ( question_attempt_step $step,
question_attempt $qa,
$seq )
inherited

Called when a new step is updated in a question attempt in this usage.

Parameters
question_attempt_step$stepthe step that was updated.
question_attempt$qathe usage it is being added to.
int$seqthe sequence number of the new step.

Implements question_usage_observer.

◆ save()

question_engine_unit_of_work::save ( question_engine_data_mapper $dm)
inherited

Write all the changes we have recorded to the database.

Parameters
question_engine_data_mapper$dmthe mapper to use to update the database.

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