Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402]
Base class for data generators component support for acceptance testing.
Copyright: | 2012 David MonllaĆ³ |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 626 lines (23 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 2 files lib/testing/generator/lib.php lib/behat/behat_base.php |
behat_generator_base:: (22 methods):
__construct()
get_available_generators()
generate_items()
name_for_errors()
get_gradecategory_id()
get_user_id()
get_userfrom_id()
get_userto_id()
get_role_id()
get_category_id()
get_course_id()
get_activity_id()
get_group_id()
get_grouping_id()
get_cohort_id()
get_outcome_id()
get_scale_id()
get_questioncategory_id()
get_context()
get_contact_id()
get_externalbackpack_id()
get_cm_by_activity_name()
Class: behat_generator_base - X-Ref
Class to quickly create Behat test data using component data generators.__construct(string $component) X-Ref |
Constructor. param: string $component component name, to make error messages more readable. |
get_available_generators() X-Ref |
Get the list of available generators for this class. return: array |
generate_items(string $generatortype, TableNode $data, bool $singular = false) X-Ref |
Do the work to generate an entity. This is called by {@link behat_data_generators::the_following_entities_exist()}. param: string $generatortype The name of the entity to create. param: TableNode $data from the step. param: bool $singular Whether there is only one record and it is pivotted |
name_for_errors(string $entitytype) X-Ref |
Helper for formatting error messages. param: string $entitytype entity type without prefix, e.g. 'frog'. return: string either 'frog' for core entities, or 'mod_mymod > frog' for components. |
get_gradecategory_id($fullname) X-Ref |
Gets the grade category id from the grade category fullname param: string $fullname the grade category name. return: int corresponding id. |
get_user_id($username) X-Ref |
Gets the user id from it's username. param: string $username return: int |
get_userfrom_id(string $username) X-Ref |
Gets the user id from it's username. param: string $username return: int |
get_userto_id(string $username) X-Ref |
Gets the user id from it's username. param: string $username return: int |
get_role_id($roleshortname) X-Ref |
Gets the role id from it's shortname. param: string $roleshortname return: int |
get_category_id($idnumber) X-Ref |
Gets the category id from it's idnumber. param: string $idnumber return: int |
get_course_id($shortname) X-Ref |
Gets the course id from it's shortname. param: string $shortname return: int |
get_activity_id(string $idnumber) X-Ref |
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. param: string $idnumber return: int |
get_group_id($idnumber) X-Ref |
Gets the group id from it's idnumber. param: string $idnumber return: int |
get_grouping_id($idnumber) X-Ref |
Gets the grouping id from it's idnumber. param: string $idnumber return: int |
get_cohort_id($idnumber) X-Ref |
Gets the cohort id from it's idnumber. param: string $idnumber return: int |
get_outcome_id($shortname) X-Ref |
Gets the outcome item id from its shortname. param: string $shortname return: int |
get_scale_id($name) X-Ref |
Get the id of a named scale. param: string $name the name of the scale. return: int the scale id. |
get_questioncategory_id($name) X-Ref |
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. param: string $name the question category name. return: int the question category id. |
get_context($levelname, $contextref) X-Ref |
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. param: string $levelname The context level string introduced by the test writer param: string $contextref The context reference introduced by the test writer return: context |
get_contact_id($username) X-Ref |
Gets the contact id from it's username. param: string $username return: int |
get_externalbackpack_id($backpackweburl) X-Ref |
Gets the external backpack id from it's backpackweburl. param: string $backpackweburl return: mixed |
get_cm_by_activity_name(string $activity, string $identifier) X-Ref |
Get a coursemodule from an activity name or idnumber. param: string $activity param: string $identifier return: cm_info |