Behat configuration manager.
More...
|
| clean_path ($path) |
| Cleans the path returned by get_components_with_tests() to standarize it. More...
|
|
| filtered_features_with_tags ($features='', $tags='') |
| Search feature files for set of tags. More...
|
|
| get_behat_config_for_profile ($profile, $values) |
| Parse $CFG->behat_config and return the array with required config structure for behat.yml. More...
|
|
| get_clean_feature_key_and_path ($featurepath) |
| Return feature key for featurepath. More...
|
|
| get_components_contexts ($component='') |
| Gets the list of Moodle behat contexts. More...
|
|
| get_components_features ($tags='') |
| Return list of features. More...
|
|
| get_config_file_contents ($features='', $contexts='', $tags='', $parallelruns=0, $currentrun=0) |
| Behat config file specifing the main context class, the required Behat extensions and Moodle test wwwroot. More...
|
|
| get_current_run () |
| Return current run. More...
|
|
| get_number_of_parallel_run () |
| Return parallel runs. More...
|
|
| get_theme_config ($themename) |
| Return the theme config for a given theme name. More...
|
|
| merge_behat_config ($config) |
| Merges $CFG->behat_config with the one passed. More...
|
|
| merge_behat_profiles ($config) |
| Merges $CFG->behat_profiles with the one passed. More...
|
|
| merge_config ($config, $localconfig) |
| Overrides default config with local config values. More...
|
|
| profile_guided_allocate ($features, $nbuckets, $instance) |
| Attempt to split feature list into fairish buckets using timing information, if available. More...
|
|
| set_parallel_run ($parallelruns, $currentrun) |
| Set parallel run to be used for generating config. More...
|
|
| set_tag_for_feature_filter ($tags) |
| Set the value for tags, so features which are returned will be using filtered by this. More...
|
|
| set_theme_suite_to_include_core_features ($themetoset) |
| Set value for theme suite to include all core features. More...
|
|
|
string const | ALL_THEMES_TO_RUN = 'ALL' |
| used to specify if behat should be initialised with all themes.
|
|
|
| build_config ($parallelruns=0, $currentrun=0) |
| Build config for behat.yml. More...
|
|
| fix_legacy_profile_data (string $profilename, array $data) |
| Check for and attempt to fix legacy profile data. More...
|
|
| get_behat_contexts_for_theme ($theme) |
| Return list of behat contexts for theme and update $this->stepdefinitions list. More...
|
|
| get_behat_features_for_theme ($theme) |
| Return list of blacklisted behat features for theme and features defined by theme only. More...
|
|
| get_behat_profile ($profile, $values) |
| Parse $CFG->behat_profile and return the array with required config structure for behat.yml. More...
|
|
| get_behat_suites ($parallelruns=0, $currentrun=0) |
| Return list of behat suites. More...
|
|
| get_blacklisted_tests_for_theme ($theme, $testtype) |
| Return blacklisted contexts or features for a theme, as defined in blacklist.json. More...
|
|
| get_components_with_tests () |
| List of components which contain behat context or features. More...
|
|
| get_default_theme () |
| Return name of default theme. More...
|
|
| get_features_for_the_run ($features, $parallelruns, $currentrun) |
| Divide features between the runs and return list. More...
|
|
| get_list_of_themes () |
| Return list of themes which can be set in moodle. More...
|
|
| get_mobile_version_tags ($verbose=true) |
| Gets version tags to use for the mobile app. More...
|
|
| get_test_directories_overridden_for_theme ($theme, $testtype) |
| Returns all the directories having overridden tests. More...
|
|
| get_tests_for_theme ($theme, $testtype) |
| Return list of features and step definitions in theme. More...
|
|
| get_theme_test_directory ($themename) |
| Return theme directory. More...
|
|
| remove_blacklisted_features_from_list ($features, $blacklist) |
| Remove list of blacklisted features from the feature list. More...
|
|
Behat configuration manager.
Creates/updates Behat config files getting tests and steps from Moodle codebase
- Copyright
- 2016 Rajesh Taneja
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ build_config()
behat_config_util::build_config |
( |
|
$parallelruns = 0 , |
|
|
|
$currentrun = 0 |
|
) |
| |
|
protected |
Build config for behat.yml.
- Parameters
-
int | $parallelruns | how many parallel runs feature needs to be divided. |
int | $currentrun | current run for which features should be returned. |
- Return values
-
◆ clean_path()
behat_config_util::clean_path |
( |
|
$path | ) |
|
|
final |
Cleans the path returned by get_components_with_tests() to standarize it.
- See also
- tests_finder::get_all_directories_with_tests() it returns the path including /tests/
- Parameters
-
- Return values
-
string | The string without the last /tests part |
◆ filtered_features_with_tags()
behat_config_util::filtered_features_with_tags |
( |
|
$features = '' , |
|
|
|
$tags = '' |
|
) |
| |
Search feature files for set of tags.
- Parameters
-
array | $features | set of feature files. |
string | $tags | list of tags (currently support && only.) |
- Return values
-
array | filtered list of feature files with tags. |
◆ fix_legacy_profile_data()
behat_config_util::fix_legacy_profile_data |
( |
string |
$profilename, |
|
|
array |
$data |
|
) |
| |
|
protected |
Check for and attempt to fix legacy profile data.
The Mink Driver used for W3C no longer uses the selenium2
naming but otherwise is backwards compatibly.
Emit a warning that users should update their configuration.
- Parameters
-
string | $profilename | The name of this profile |
array | $data | The profile data for this profile |
- Return values
-
array | Th eamended profile data |
◆ get_behat_config_for_profile()
behat_config_util::get_behat_config_for_profile |
( |
|
$profile, |
|
|
|
$values |
|
) |
| |
Parse $CFG->behat_config and return the array with required config structure for behat.yml.
- Parameters
-
string | $profile | profile name |
array | $values | values for profile |
- Return values
-
◆ get_behat_contexts_for_theme()
behat_config_util::get_behat_contexts_for_theme |
( |
|
$theme | ) |
|
|
protected |
Return list of behat contexts for theme and update $this->stepdefinitions list.
- Parameters
-
- Return values
-
◆ get_behat_features_for_theme()
behat_config_util::get_behat_features_for_theme |
( |
|
$theme | ) |
|
|
protected |
Return list of blacklisted behat features for theme and features defined by theme only.
- Parameters
-
- Return values
-
array | ($blacklistfeatures, $blacklisttags, $features) |
◆ get_behat_profile()
behat_config_util::get_behat_profile |
( |
|
$profile, |
|
|
|
$values |
|
) |
| |
|
protected |
Parse $CFG->behat_profile and return the array with required config structure for behat.yml.
$CFG->behat_profiles = array( 'profile' = array( 'browser' => 'firefox', 'tags' => '@javascript', 'wd_host' => 'http://127.0.0.1:4444/wd/hub', 'capabilities' => array( 'platform' => 'Linux', 'version' => 44 ) ) );
- Parameters
-
string | $profile | profile name |
array | $values | values for profile. |
- Return values
-
◆ get_behat_suites()
behat_config_util::get_behat_suites |
( |
|
$parallelruns = 0 , |
|
|
|
$currentrun = 0 |
|
) |
| |
|
protected |
Return list of behat suites.
Multiple suites are returned if theme overrides default step definitions/features.
- Parameters
-
int | $parallelruns | number of parallel runs |
int | $currentrun | current run. |
- Return values
-
◆ get_behat_tests_path()
static behat_config_util::get_behat_tests_path |
( |
| ) |
|
|
staticfinal |
The relative path where components stores their behat tests.
- Return values
-
◆ get_behat_theme_selector_override_classname()
static behat_config_util::get_behat_theme_selector_override_classname |
( |
|
$themename, |
|
|
|
$selectortype, |
|
|
|
$includeclass = false |
|
) |
| |
|
staticfinal |
Return context name of behat_theme selector to use.
- Parameters
-
string | $themename | name of the theme. |
string | $selectortype | The type of selector (partial or exact at this stage) |
bool | $includeclass | if class should be included. |
- Return values
-
◆ get_blacklisted_tests_for_theme()
behat_config_util::get_blacklisted_tests_for_theme |
( |
|
$theme, |
|
|
|
$testtype |
|
) |
| |
|
protected |
Return blacklisted contexts or features for a theme, as defined in blacklist.json.
- Parameters
-
string | $theme | themename |
string | $testtype | test type (contexts|features) |
- Return values
-
array | list of blacklisted contexts or features |
◆ get_clean_feature_key_and_path()
behat_config_util::get_clean_feature_key_and_path |
( |
|
$featurepath | ) |
|
Return feature key for featurepath.
- Parameters
-
- Return values
-
array | key and featurepath. |
◆ get_components_contexts()
behat_config_util::get_components_contexts |
( |
|
$component = '' | ) |
|
Gets the list of Moodle behat contexts.
Class name as a key and the filepath as value
Externalized from update_config_file() to use it from the steps definitions web interface
- Parameters
-
string | $component | Restricts the obtained steps definitions to the specified component |
- Return values
-
◆ get_components_features()
behat_config_util::get_components_features |
( |
|
$tags = '' | ) |
|
Return list of features.
- Parameters
-
- Return values
-
◆ get_components_with_tests()
behat_config_util::get_components_with_tests |
( |
| ) |
|
|
protected |
List of components which contain behat context or features.
- Return values
-
◆ get_config_file_contents()
behat_config_util::get_config_file_contents |
( |
|
$features = '' , |
|
|
|
$contexts = '' , |
|
|
|
$tags = '' , |
|
|
|
$parallelruns = 0 , |
|
|
|
$currentrun = 0 |
|
) |
| |
Behat config file specifing the main context class, the required Behat extensions and Moodle test wwwroot.
- Parameters
-
array | $features | The system feature files |
array | $contexts | The system steps definitions |
string | $tags | filter features with specified tags. |
int | $parallelruns | number of parallel runs. |
int | $currentrun | current run for which config file is needed. |
- Return values
-
◆ get_current_run()
behat_config_util::get_current_run |
( |
| ) |
|
Return current run.
- Return values
-
◆ get_default_theme()
behat_config_util::get_default_theme |
( |
| ) |
|
|
protected |
Return name of default theme.
- Return values
-
◆ get_features_for_the_run()
behat_config_util::get_features_for_the_run |
( |
|
$features, |
|
|
|
$parallelruns, |
|
|
|
$currentrun |
|
) |
| |
|
protected |
Divide features between the runs and return list.
- Parameters
-
array | $features | list of features to be divided. |
int | $parallelruns | how many parallel runs feature needs to be divided. |
int | $currentrun | current run for which features should be returned. |
- Return values
-
◆ get_list_of_themes()
behat_config_util::get_list_of_themes |
( |
| ) |
|
|
protected |
Return list of themes which can be set in moodle.
- Return values
-
array | list of themes with tests. |
◆ get_mobile_version_tags()
behat_config_util::get_mobile_version_tags |
( |
|
$verbose = true | ) |
|
|
protected |
Gets version tags to use for the mobile app.
This is based on the current mobile app version (from its package.json) and all known mobile app versions (based on the list appversions.json in the lib/behat directory).
- Parameters
-
bool | $verbose | If true, outputs information about installed app version |
- Return values
-
string | List of tags or '' if not supporting mobile |
◆ get_number_of_parallel_run()
behat_config_util::get_number_of_parallel_run |
( |
| ) |
|
Return parallel runs.
- Return values
-
int | number of parallel runs. |
◆ get_test_directories_overridden_for_theme()
behat_config_util::get_test_directories_overridden_for_theme |
( |
|
$theme, |
|
|
|
$testtype |
|
) |
| |
|
protected |
Returns all the directories having overridden tests.
- Parameters
-
string | $theme | name of theme |
string | $testtype | The kind of test we are looking for |
- Return values
-
array | all directories having tests |
◆ get_tests_for_theme()
behat_config_util::get_tests_for_theme |
( |
|
$theme, |
|
|
|
$testtype |
|
) |
| |
|
protected |
Return list of features and step definitions in theme.
- Parameters
-
string | $theme | theme name |
string | $testtype | test type, either features or contexts |
- Return values
-
array | list of contexts $contexts or $features |
◆ get_theme_config()
behat_config_util::get_theme_config |
( |
|
$themename | ) |
|
Return the theme config for a given theme name.
This is done so we can mock it in PHPUnit.
- Parameters
-
string | $themename | name of theme |
- Return values
-
◆ get_theme_test_directory()
behat_config_util::get_theme_test_directory |
( |
|
$themename | ) |
|
|
protected |
Return theme directory.
- Parameters
-
string | $themename | name of theme |
- Return values
-
◆ merge_behat_config()
behat_config_util::merge_behat_config |
( |
|
$config | ) |
|
Merges $CFG->behat_config with the one passed.
- Parameters
-
array | $config | existing config. |
- Return values
-
array | merged config with $CFG->behat_config |
◆ merge_behat_profiles()
behat_config_util::merge_behat_profiles |
( |
|
$config | ) |
|
Merges $CFG->behat_profiles with the one passed.
- Parameters
-
array | $config | existing config. |
- Return values
-
array | merged config with $CFG->behat_profiles |
◆ merge_config()
behat_config_util::merge_config |
( |
|
$config, |
|
|
|
$localconfig |
|
) |
| |
Overrides default config with local config values.
array_merge does not merge completely the array's values
- Parameters
-
mixed | $config | The node of the default config |
mixed | $localconfig | The node of the local config |
- Return values
-
◆ profile_guided_allocate()
behat_config_util::profile_guided_allocate |
( |
|
$features, |
|
|
|
$nbuckets, |
|
|
|
$instance |
|
) |
| |
Attempt to split feature list into fairish buckets using timing information, if available.
Simply add each one to lightest buckets until all files allocated. PGA = Profile Guided Allocation. I made it up just now. CAUTION: workers must agree on allocation, do not be random anywhere!
- Parameters
-
array | $features | Behat feature files array |
int | $nbuckets | Number of buckets to divide into |
int | $instance | Index number of this instance |
- Return values
-
array|bool | Feature files array, sorted into allocations |
◆ remove_blacklisted_features_from_list()
behat_config_util::remove_blacklisted_features_from_list |
( |
|
$features, |
|
|
|
$blacklist |
|
) |
| |
|
protected |
Remove list of blacklisted features from the feature list.
- Parameters
-
array | $features | list of original features. |
array | string | $blacklist | list of features which needs to be removed. |
- Return values
-
array | features - blacklisted features. |
◆ set_parallel_run()
behat_config_util::set_parallel_run |
( |
|
$parallelruns, |
|
|
|
$currentrun |
|
) |
| |
Set parallel run to be used for generating config.
- Parameters
-
int | $parallelruns | number of parallel runs. |
int | $currentrun | current run |
◆ set_tag_for_feature_filter()
behat_config_util::set_tag_for_feature_filter |
( |
|
$tags | ) |
|
Set the value for tags, so features which are returned will be using filtered by this.
- Parameters
-
◆ set_theme_suite_to_include_core_features()
behat_config_util::set_theme_suite_to_include_core_features |
( |
|
$themetoset | ) |
|
Set value for theme suite to include all core features.
This should be used if your want all core features to be run with theme.
- Parameters
-
The documentation for this class was generated from the following file: