See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401] [Versions 401 and 403]
Utils to set Behat config
Copyright: | 2016 Rajesh Taneja |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 1565 lines (58 kb) |
Included or required: | 1 time |
Referenced: | 0 times |
Includes or requires: | 3 files lib/behat/classes/behat_command.php lib/behat/lib.php lib/testing/classes/tests_finder.php |
behat_config_util:: (37 methods):
set_theme_suite_to_include_core_features()
set_tag_for_feature_filter()
set_parallel_run()
get_number_of_parallel_run()
get_current_run()
get_components_features()
get_clean_feature_key_and_path()
get_component_contexts()
get_components_contexts()
sort_component_contexts()
get_config_file_contents()
filtered_features_with_tags()
build_config()
get_features_for_the_run()
get_behat_profile()
get_mobile_version_tags()
profile_guided_allocate()
merge_config()
merge_behat_config()
get_behat_config_for_profile()
merge_behat_profiles()
fix_legacy_profile_data()
clean_path()
get_behat_tests_path()
get_behat_theme_selector_override_classname()
get_components_with_tests()
remove_blacklisted_features_from_list()
get_behat_suites()
get_default_theme()
get_list_of_themes()
get_theme_config()
get_theme_test_directory()
get_test_directories_overridden_for_theme()
get_blacklisted_tests_for_theme()
get_tests_for_theme()
get_behat_features_for_theme()
get_behat_contexts_for_theme()
Class: behat_config_util - X-Ref
Behat configuration managerset_theme_suite_to_include_core_features($themetoset) X-Ref |
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. param: bool $themetoset |
set_tag_for_feature_filter($tags) X-Ref |
Set the value for tags, so features which are returned will be using filtered by this. param: string $tags |
set_parallel_run($parallelruns, $currentrun) X-Ref |
Set parallel run to be used for generating config. param: int $parallelruns number of parallel runs. param: int $currentrun current run |
get_number_of_parallel_run() X-Ref |
Return parallel runs return: int number of parallel runs. |
get_current_run() X-Ref |
Return current run return: int current run. |
get_components_features($tags = '') X-Ref |
Return list of features. param: string $tags tags. return: array |
get_clean_feature_key_and_path($featurepath) X-Ref |
Return feature key for featurepath param: string $featurepath return: array key and featurepath. |
get_component_contexts($component) X-Ref |
Get component contexts. param: string $component component name. return: array |
get_components_contexts($component = '') X-Ref |
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 param: string $component Restricts the obtained steps definitions to the specified component return: array |
sort_component_contexts(array $contexts) X-Ref |
Sort the list of components contexts. This ensures that contexts are sorted consistently. Core hooks defined in the behat_hooks class _must_ be defined first. param: array $contexts return: array The sorted context list |
get_config_file_contents($features = '', $contexts = '', $tags = '', $parallelruns = 0, $currentrun = 0) X-Ref |
Behat config file specifing the main context class, the required Behat extensions and Moodle test wwwroot. param: array $features The system feature files param: array $contexts The system steps definitions param: string $tags filter features with specified tags. param: int $parallelruns number of parallel runs. param: int $currentrun current run for which config file is needed. return: string |
filtered_features_with_tags($features = '', $tags = '') X-Ref |
Search feature files for set of tags. param: array $features set of feature files. param: string $tags list of tags (currently support && only.) return: array filtered list of feature files with tags. |
build_config($parallelruns = 0, $currentrun = 0) X-Ref |
Build config for behat.yml. param: int $parallelruns how many parallel runs feature needs to be divided. param: int $currentrun current run for which features should be returned. return: array |
get_features_for_the_run($features, $parallelruns, $currentrun) X-Ref |
Divide features between the runs and return list. param: array $features list of features to be divided. param: int $parallelruns how many parallel runs feature needs to be divided. param: int $currentrun current run for which features should be returned. return: array |
get_behat_profile($profile, $values) X-Ref |
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 ) ) ); param: string $profile profile name param: array $values values for profile. return: array |
get_mobile_version_tags($verbose = true) X-Ref |
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). param: bool $verbose If true, outputs information about installed app version return: string List of tags or '' if not supporting mobile |
profile_guided_allocate($features, $nbuckets, $instance) X-Ref |
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! param: array $features Behat feature files array param: int $nbuckets Number of buckets to divide into param: int $instance Index number of this instance return: array|bool Feature files array, sorted into allocations |
merge_config($config, $localconfig) X-Ref |
Overrides default config with local config values array_merge does not merge completely the array's values param: mixed $config The node of the default config param: mixed $localconfig The node of the local config return: mixed The merge result |
merge_behat_config($config) X-Ref |
Merges $CFG->behat_config with the one passed. param: array $config existing config. return: array merged config with $CFG->behat_config |
get_behat_config_for_profile($profile, $values) X-Ref |
Parse $CFG->behat_config and return the array with required config structure for behat.yml param: string $profile profile name param: array $values values for profile return: array |
merge_behat_profiles($config) X-Ref |
Merges $CFG->behat_profiles with the one passed. param: array $config existing config. return: array merged config with $CFG->behat_profiles |
fix_legacy_profile_data(string $profilename, array $data) X-Ref |
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. param: string $profilename The name of this profile param: array $data The profile data for this profile return: array Th eamended profile data |
clean_path($path) X-Ref |
Cleans the path returned by get_components_with_tests() to standarize it param: string $path return: string The string without the last /tests part |
get_behat_tests_path() X-Ref |
The relative path where components stores their behat tests return: string |
get_behat_theme_selector_override_classname($themename, $selectortype, $includeclass = false) X-Ref |
Return context name of behat_theme selector to use. param: string $themename name of the theme. param: string $selectortype The type of selector (partial or exact at this stage) param: bool $includeclass if class should be included. return: string |
get_components_with_tests() X-Ref |
List of components which contain behat context or features. return: array |
remove_blacklisted_features_from_list($features, $blacklist) X-Ref |
Remove list of blacklisted features from the feature list. param: array $features list of original features. param: array|string $blacklist list of features which needs to be removed. return: array features - blacklisted features. |
get_behat_suites($parallelruns = 0, $currentrun = 0) X-Ref |
Return list of behat suites. Multiple suites are returned if theme overrides default step definitions/features. param: int $parallelruns number of parallel runs param: int $currentrun current run. return: array list of suites. |
get_default_theme() X-Ref |
Return name of default theme. return: string |
get_list_of_themes() X-Ref |
Return list of themes which can be set in moodle. return: array list of themes with tests. |
get_theme_config($themename) X-Ref |
Return the theme config for a given theme name. This is done so we can mock it in PHPUnit. param: string $themename name of theme return: theme_config |
get_theme_test_directory($themename) X-Ref |
Return theme directory. param: string $themename name of theme return: string theme directory |
get_test_directories_overridden_for_theme($theme, $testtype) X-Ref |
Returns all the directories having overridden tests. param: string $theme name of theme param: string $testtype The kind of test we are looking for return: array all directories having tests |
get_blacklisted_tests_for_theme($theme, $testtype) X-Ref |
Return blacklisted contexts or features for a theme, as defined in blacklist.json. param: string $theme themename param: string $testtype test type (contexts|features) return: array list of blacklisted contexts or features |
get_tests_for_theme($theme, $testtype) X-Ref |
Return list of features and step definitions in theme. param: string $theme theme name param: string $testtype test type, either features or contexts return: array list of contexts $contexts or $features |
get_behat_features_for_theme($theme) X-Ref |
Return list of blacklisted behat features for theme and features defined by theme only. param: string $theme theme name. return: array ($blacklistfeatures, $blacklisttags, $features) |
get_behat_contexts_for_theme($theme) X-Ref |
Return list of behat contexts for theme and update $this->stepdefinitions list. param: string $theme theme name. return: List of contexts |