[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/behat/classes/ -> behat_config_manager.php (summary)

Utils to set Behat config

Copyright: 2012 David Monllaó
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 700 lines (26 kb)
Included or required: 3 times
Referenced: 0 times
Includes or requires: 3 files
 lib/testing/classes/tests_finder.php
 lib/behat/classes/behat_command.php
 lib/behat/lib.php

Defines 1 class

behat_config_manager:: (16 methods):
  update_config_file()
  get_features_with_tags()
  get_components_steps_definitions()
  get_steps_list_config_filepath()
  get_behat_cli_config_filepath()
  get_parallel_test_file_path()
  get_parallel_test_runs()
  drop_parallel_site_links()
  create_parallel_site_links()
  get_config_file_contents()
  merge_behat_config()
  get_behat_profile()
  profile_guided_allocate()
  merge_config()
  clean_path()
  get_behat_tests_path()


Class: behat_config_manager  - X-Ref

Behat configuration manager

Creates/updates Behat config files getting tests
and steps from Moodle codebase

update_config_file($component = '', $testsrunner = true, $tags = '')   X-Ref
Updates a config file

The tests runner and the steps definitions list uses different
config files to avoid problems with concurrent executions.

The steps definitions list can be filtered by component so it's
behat.yml is different from the $CFG->dirroot one.

param: string $component Restricts the obtained steps definitions to the specified component
param: string $testsrunner If the config file will be used to run tests
param: string $tags features files including tags.
return: void

get_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.

get_components_steps_definitions()   X-Ref
Gets the list of Moodle steps definitions

Class name as a key and the filepath as value

Externalized from update_config_file() to use
it from the steps definitions web interface

return: array

get_steps_list_config_filepath()   X-Ref
Returns the behat config file path used by the steps definition list

return: string

get_behat_cli_config_filepath($runprocess = 0)   X-Ref
Returns the behat config file path used by the behat cli command.

param: int $runprocess Runprocess.
return: string

get_parallel_test_file_path($runprocess = 0)   X-Ref
Returns the path to the parallel run file which specifies if parallel test environment is enabled
and how many parallel runs to execute.

param: int $runprocess run process for which behat dir is returned.
return: string

get_parallel_test_runs($runprocess = 0)   X-Ref
Returns number of parallel runs for which site is initialised.

param: int $runprocess run process for which behat dir is returned.
return: int

drop_parallel_site_links()   X-Ref
Drops parallel site links.

return: bool true on success else false.

create_parallel_site_links($fromrun, $torun)   X-Ref
Create parallel site links.

param: int $fromrun first run
param: int $torun last run.
return: bool true for sucess, else false.

get_config_file_contents($features, $stepsdefinitions)   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 $stepsdefinitions The system steps definitions
return: string

merge_behat_config($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

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

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 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

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



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1