Behat data generator for mod_book.
More...
|
| generate_items (string $generatortype, TableNode $data, bool $singular=false) |
| Do the work to generate an entity. More...
|
|
Behat data generator for mod_book.
- Copyright
- 2019 The Open University
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ generate_items()
behat_generator_base::generate_items |
( |
string |
$generatortype, |
|
|
TableNode |
$data, |
|
|
bool |
$singular = false |
|
) |
| |
|
inherited |
Do the work to generate an entity.
This is called by behat_data_generators::the_following_entities_exist().
- Parameters
-
string | $generatortype | The name of the entity to create. |
TableNode | $data | from the step. |
bool | $singular | Whether there is only one record and it is pivotted |
◆ get_activity_id()
behat_generator_base::get_activity_id |
( |
string |
$idnumber | ) |
|
|
protectedinherited |
Gets the course cmid for the specified activity based on the activity's idnumber.
Note: this does not check the module type, only the idnumber.
- Exceptions
-
- Parameters
-
- Return values
-
◆ get_book_id()
behat_mod_book_generator::get_book_id |
( |
string |
$bookname | ) |
|
|
protected |
Look up the id of a book from its name.
- Parameters
-
string | $bookname | the book name, for example 'Test book'. |
- Return values
-
◆ get_category_id()
behat_generator_base::get_category_id |
( |
|
$idnumber | ) |
|
|
protectedinherited |
Gets the category id from it's idnumber.
- Exceptions
-
- Parameters
-
- Return values
-
◆ get_cm_by_activity_name()
behat_generator_base::get_cm_by_activity_name |
( |
string |
$activity, |
|
|
string |
$identifier |
|
) |
| |
|
protectedinherited |
Get a coursemodule from an activity name or idnumber.
- Parameters
-
string | $activity | |
string | $identifier | |
- Return values
-
◆ get_cohort_id()
behat_generator_base::get_cohort_id |
( |
|
$idnumber | ) |
|
|
protectedinherited |
Gets the cohort id from it's idnumber.
- Exceptions
-
- Parameters
-
- Return values
-
◆ get_contact_id()
behat_generator_base::get_contact_id |
( |
|
$username | ) |
|
|
protectedinherited |
Gets the contact id from it's username.
- Exceptions
-
- Parameters
-
- Return values
-
◆ get_context()
behat_generator_base::get_context |
( |
|
$levelname, |
|
|
|
$contextref |
|
) |
| |
|
protectedinherited |
Gets the internal context id from the context reference.
The context reference changes depending on the context level, it can be the system, a user, a category, a course or a module.
- Exceptions
-
- Parameters
-
string | $levelname | The context level string introduced by the test writer |
string | $contextref | The context reference introduced by the test writer |
- Return values
-
◆ get_course_id()
behat_generator_base::get_course_id |
( |
|
$shortname | ) |
|
|
protectedinherited |
Gets the course id from it's shortname.
- Exceptions
-
- Parameters
-
- Return values
-
◆ get_creatable_entities()
behat_mod_book_generator::get_creatable_entities |
( |
| ) |
|
|
protected |
Get a list of the entities that can be created for this component.
This function must be overridden in subclasses. See class comment above for a description of the data structure. See behat_core_generator for an example.
- Return values
-
array | entity name => information about how to generate. |
Reimplemented from behat_generator_base.
◆ get_externalbackpack_id()
behat_generator_base::get_externalbackpack_id |
( |
|
$backpackweburl | ) |
|
|
protectedinherited |
Gets the external backpack id from it's backpackweburl.
- Parameters
-
- Return values
-
- Exceptions
-
◆ get_gradecategory_id()
behat_generator_base::get_gradecategory_id |
( |
|
$fullname | ) |
|
|
protectedinherited |
Gets the grade category id from the grade category fullname.
- Parameters
-
string | $fullname | the grade category name. |
- Return values
-
◆ get_group_id()
behat_generator_base::get_group_id |
( |
|
$idnumber | ) |
|
|
protectedinherited |
Gets the group id from it's idnumber.
- Exceptions
-
- Parameters
-
- Return values
-
◆ get_grouping_id()
behat_generator_base::get_grouping_id |
( |
|
$idnumber | ) |
|
|
protectedinherited |
Gets the grouping id from it's idnumber.
- Exceptions
-
- Parameters
-
- Return values
-
◆ get_outcome_id()
behat_generator_base::get_outcome_id |
( |
|
$shortname | ) |
|
|
protectedinherited |
Gets the outcome item id from its shortname.
- Exceptions
-
- Parameters
-
- Return values
-
◆ get_questioncategory_id()
behat_generator_base::get_questioncategory_id |
( |
|
$name | ) |
|
|
protectedinherited |
Get the id of a named question category (must be globally unique).
Note that 'Top' is a special value, used when setting the parent of another category, meaning top-level.
- Parameters
-
string | $name | the question category name. |
- Return values
-
int | the question category id. |
◆ get_role_id()
behat_generator_base::get_role_id |
( |
|
$roleshortname | ) |
|
|
protectedinherited |
Gets the role id from it's shortname.
- Exceptions
-
- Parameters
-
- Return values
-
◆ get_scale_id()
behat_generator_base::get_scale_id |
( |
|
$name | ) |
|
|
protectedinherited |
Get the id of a named scale.
- Parameters
-
string | $name | the name of the scale. |
- Return values
-
◆ get_user_id()
behat_generator_base::get_user_id |
( |
|
$username | ) |
|
|
protectedinherited |
Gets the user id from it's username.
- Exceptions
-
- Parameters
-
- Return values
-
◆ name_for_errors()
behat_generator_base::name_for_errors |
( |
string |
$entitytype | ) |
|
|
protectedinherited |
Helper for formatting error messages.
- Parameters
-
string | $entitytype | entity type without prefix, e.g. 'frog'. |
- Return values
-
string | either 'frog' for core entities, or 'mod_mymod > frog' for components. |
◆ $component
string behat_generator_base::$component |
|
protectedinherited |
the name of the component we belong to.
This should probably only be used to make error messages clearer.
The documentation for this class was generated from the following file: