[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/tests/behat/ -> behat_data_generators.php (summary)

Data generators for acceptance testing.

Copyright: 2012 David Monllaó
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 695 lines (24 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 2 files
 lib/testing/generator/lib.php
 lib/behat/behat_base.php

Defines 1 class

behat_data_generators:: (22 methods):
  the_following_exist()
  preprocess_user()
  preprocess_cohort()
  preprocess_grade_item()
  process_activity()
  process_enrol_user()
  process_permission_override()
  process_system_role_assign()
  process_role_assign()
  process_role()
  process_cohort_member()
  get_gradecategory_id()
  get_user_id()
  get_role_id()
  get_category_id()
  get_course_id()
  get_group_id()
  get_grouping_id()
  get_cohort_id()
  get_outcome_id()
  get_scale_id()
  get_context()


Class: behat_data_generators  - X-Ref

Class to set up quickly a Given environment.

Acceptance tests are block-boxed, so this steps definitions should only
be used to set up the test environment as we are not replicating user steps.

All data generators should be in lib/testing/generator/*, shared between phpunit
and behat and they should be called from here, if possible using the standard
'create_$elementname($options)' and if it's not possible (data generators arguments will not be
always the same) or the element is not suitable to be a data generator, create a
'process_$elementname($options)' method and use the data generator from there if possible.

the_following_exist($elementname, TableNode $data)   X-Ref
Creates the specified element. More info about available elements in http://docs.moodle.org/dev/Acceptance_testing#Fixtures.

param: string    $elementname The name of the entity to add
param: TableNode $data

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

param: array $data
return: array

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

param: array $data
return: array

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

param: array $data
return: array

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

param: array $data
return: void

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

param: array $data
return: void

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

param: array $data
return: void

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"

param: array $data
return: void

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

param: array $data
return: void

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

param: array $data
return: void

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

param: array $data
return: void

get_gradecategory_id($fullname)   X-Ref
Gets the grade category id from the grade category fullname

param: string $username
return: int

get_user_id($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_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
Gets the course id from its name.

param: string $name
return: int

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



Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1