Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Class: behat_core_generator  - X-Ref

Behat data generator class for core entities.

get_creatable_entities()   X-Ref
No description

get_gradeitem_id(string $name)   X-Ref
Get the grade item id using a name.

return: int The grade item id
param: string $name

preprocess_course($data)   X-Ref
Remove any empty custom fields, to avoid errors when creating the course.

return: array
param: array $data

preprocess_user($data)   X-Ref
If password is not set it uses the username.

return: array
param: array $data

preprocess_cohort($data)   X-Ref
If contextlevel and reference are specified for cohort, transform them to the contextid.

return: array
param: array $data

preprocess_grade_item($data)   X-Ref
Preprocesses the creation of a grade item. Converts gradetype text to a number.

return: array
param: array $data

process_activity($data)   X-Ref
Adapter to modules generator.

return: void
param: array $data

process_block_instance($data)   X-Ref
Add a block to a page.

param: array $data should mostly match the fields of the block_instances table.

process_customlang($data)   X-Ref
Creates language customisation.

return: void
param: array $data

process_langpack($data)   X-Ref
Imports a langpack.

param: array $data

process_enrol_user($data)   X-Ref
Adapter to enrol_user() data generator.

return: void
param: array $data

process_permission_override($data)   X-Ref
Allows/denies a capability at the specified context

return: void
param: array $data

process_system_role_assign($data)   X-Ref
Assigns a role to a user at system context

Used by "system role assigns" can be deleted when
system role assign will be deprecated in favour of
"role assigns"

return: void
param: array $data

process_role_assign($data)   X-Ref
Assigns a role to a user at the specified context

return: void
param: array $data

process_role($data)   X-Ref
Creates a role.

return: void
param: array $data

process_role_capability($data)   X-Ref
Assign capabilities to a role.

param: array $data

process_cohort_member($data)   X-Ref
Adds members to cohorts

return: void
param: array $data

process_question_category($data)   X-Ref
Create a question category.

param: array $data the row of data from the behat script.

process_question($data)   X-Ref
Create a question.

Creating questions relies on the question/type/.../tests/helper.php mechanism.
We start with test_question_maker::get_question_form_data($data['qtype'], $data['template'])
and then overlay the values from any other fields of $data that are set.

There is a special case that allows you to set qtype to 'missingtype'.
This creates an example of broken question, such as you might get if you
install a question type, create some questions of that type, and then
uninstall the question type (which is prevented through the UI but can
still happen). This special lets tests verify that these questions are
handled OK.

param: array $data the row of data from the behat script.

process_message_contacts($data)   X-Ref
Adds user to contacts

return: void
param: array $data

process_private_messages(array $data)   X-Ref
Send a new message from user to contact in a private conversation

return: void
param: array $data

process_group_messages(array $data)   X-Ref
Send a new message from user to a group conversation

return: void
param: array $data

process_favourite_conversations(array $data)   X-Ref
Mark a private conversation as favourite for user

return: void
param: array $data

process_mute_group_conversations(array $data)   X-Ref
Mute an existing group conversation for user

return: void
param: array $data

process_mute_private_conversations(array $data)   X-Ref
Mute a private conversation for user

return: void
param: array $data

preprocess_analytics_model($data)   X-Ref
Transform indicators string into array.

return: array
param: array $data

process_analytics_model($data)   X-Ref
Creates an analytics model

return: void
param: target $data

process_user_preferences(array $data)   X-Ref
Set a preference value for user

return: void
param: array $data

process_contentbank_content(array $data)   X-Ref
Create content in the given context's content bank.

return: void
param: array $data

process_badge_external_backpack(array $data)   X-Ref
Create a exetrnal backpack.

param: array $data

process_setup_backpack_connected(array $data)   X-Ref
Setup a backpack connected for user.

param: array $data

process_notification(array $data)   X-Ref
Creates notifications to specific user.

return: void
param: array $data

process_last_access_times(array $data)   X-Ref
Creates user last access data within given courses.

return: void
param: array $data