Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Static Public Member Functions | |
static | build_themes () |
Build theme CSS. | |
static | check_server_status () |
Checks if $CFG->behat_wwwroot is available and using same versions for cli and web. More... | |
static | clean_tables_updated_by_scenario_list () |
Delete tablesupdatedbyscenario file. More... | |
static | drop_dataroot () |
Delete files and directories under dataroot. | |
static | drop_site () |
Drops dataroot and remove test database tables. More... | |
static | get_behat_status () |
Returns the status of the behat test environment. More... | |
static | get_data_generator () |
Get data generator. More... | |
static | get_dataroot () |
Return the dataroot. More... | |
static | get_environment () |
Return list of environment versions on which tests will run. More... | |
static | get_git_hash () |
Try to get current git hash of the Moodle in $CFG->dirroot. More... | |
static | get_originaldatafilesjson () |
Return the name of the JSON file containing the init filenames. More... | |
static | get_sequencenames () |
Returns the names of sequences for each autoincrementing id field in all standard tables. More... | |
static | get_site_info () |
Gets a text-based site version description. More... | |
static | get_tablestructure () |
Returns structure of all tables right after installation. More... | |
static | get_test_file_path () |
Returns the path to the file which specifies if test environment is enabled. More... | |
static | install_site () |
Installs a site using $CFG->dataroot and $CFG->prefix. More... | |
static | is_test_data_updated () |
Returns whether test database and dataroot were created using the current version codebase. More... | |
static | is_test_mode_enabled () |
Checks whether test environment is enabled or disabled. More... | |
static | is_test_site () |
Does this site (db and dataroot) appear to be used for production? We try very hard to prevent accidental damage done to production servers!! More... | |
static | pause (Session $session, string $message) |
Pause execution immediately. More... | |
static | remove_added_config () |
Removes config settings that were added to the main $CFG config within the Behat CLI run. More... | |
static | reset_all_data () |
Reset contents of all database tables to initial values, reset caches, etc. | |
static | reset_all_database_sequences (array $empties=null) |
Reset all database sequences to initial values. More... | |
static | reset_database () |
Reset all database tables to default values. More... | |
static | reset_dataroot () |
Purge dataroot directory. More... | |
static | reset_updated_table_list () |
Reset updated table list. More... | |
static | restore_saved_themes () |
Restore theme CSS stored during behat setup. | |
static | set_dataroot ($dataroot) |
Set the dataroot. More... | |
static | set_table_modified_by_sql ($sql) |
Set state of modified tables. More... | |
static | start_test_mode ($themesuitewithallfeatures=false, $tags='', $parallelruns=0, $run=0) |
Enables test mode. More... | |
static | stop_test_mode () |
Disables test mode. More... | |
Public Attributes | |
const | BEHATSITENAME = "Acceptance test site" |
The behat test site fullname and shortname. | |
Static Public Attributes | |
static array | $tableupdated = array() |
list of updated tables. | |
Static Protected Member Functions | |
static | drop_database ($displayprogress=false) |
Drop the whole test database. More... | |
static | get_framework () |
Returns the testing framework name. More... | |
static | get_tabledata () |
Returns contents of all tables right after installation. More... | |
static | get_tables_updated_by_scenario_list_path () |
Returns the path to the file which holds list of tables updated in scenario. More... | |
static | guess_unmodified_empty_tables () |
Returns list of tables that are unmodified and empty. More... | |
static | save_original_data_files () |
Save the list of the original dataroot files into a json file. | |
static | skip_original_data_files ($utilclassname) |
Skip the original dataroot files to not been reset. More... | |
static | store_database_state () |
Stores the status of the database. More... | |
static | store_versions_hash () |
Stores the version hash in both database and dataroot. | |
static | test_environment_problem () |
Checks whether the test database and dataroot is ready Stops execution if something went wrong. More... | |
Static Protected Attributes | |
static array | $datarootskipondrop = array('.', '..', 'lock') |
Files to skip when dropping dataroot folder. | |
static array | $datarootskiponreset = array('.', '..', 'behat', 'behattestdir.txt') |
Files to skip when resetting dataroot folder. | |
static testing_data_generator | $generator = null |
static array | $sequencenames = null |
original structure of all database tables | |
static int | $sequencenextstartingid = null |
next sequence value for a single test cycle. | |
static array | $tabledata = null |
original content of all database tables | |
static array | $tablestructure = null |
original structure of all database tables | |
static string | $versionhash = null |
current version hash from php files | |
|
static |
Checks if $CFG->behat_wwwroot is available and using same versions for cli and web.
void |
|
staticinherited |
Delete tablesupdatedbyscenario file.
This should be called before suite, to ensure full db reset.
|
staticprotectedinherited |
Drop the whole test database.
bool | $displayprogress |
|
static |
|
static |
Returns the status of the behat test environment.
int | Error code |
|
staticinherited |
Get data generator.
testing_data_generator |
|
staticinherited |
Return the dataroot.
It's useful when mocking the dataroot when unit testing this class itself.
string | the dataroot. |
|
staticinherited |
Return list of environment versions on which tests will run.
Environment includes:
array |
|
staticfinalprotectedinherited |
Returns the testing framework name.
string |
|
staticinherited |
Try to get current git hash of the Moodle in $CFG->dirroot.
string | null if unknown, sha1 hash if known |
|
staticinherited |
Return the name of the JSON file containing the init filenames.
string |
|
staticinherited |
Returns the names of sequences for each autoincrementing id field in all standard tables.
array::$table,=>$sequencename |
|
staticinherited |
Gets a text-based site version description.
string | The site info |
|
staticprotectedinherited |
Returns contents of all tables right after installation.
array::$table,=>$records |
|
staticfinalprotectedinherited |
Returns the path to the file which holds list of tables updated in scenario.
string |
|
staticinherited |
Returns structure of all tables right after installation.
array::$table,=>$records |
|
staticfinal |
Returns the path to the file which specifies if test environment is enabled.
string |
|
staticprotectedinherited |
Returns list of tables that are unmodified and empty.
array | of table names, empty if unknown |
|
static |
Installs a site using $CFG->dataroot and $CFG->prefix.
coding_exception |
void |
|
staticinherited |
Returns whether test database and dataroot were created using the current version codebase.
bool |
|
static |
Checks whether test environment is enabled or disabled.
To check is the current script is running in the test environment
bool |
|
staticinherited |
Does this site (db and dataroot) appear to be used for production? We try very hard to prevent accidental damage done to production servers!!
bool |
|
static |
Pause execution immediately.
Session | $session | |
string | $message | The message to show when pausing. This will be passed through cli_ansi_format so appropriate ANSI formatting and features are available. |
|
static |
Removes config settings that were added to the main $CFG config within the Behat CLI run.
Database storage is already handled by reset_database and existing config values will be reset automatically by initialise_cfg(), so we only need to remove added ones.
|
staticinherited |
Reset all database sequences to initial values.
array | $empties | tables that are known to be unmodified and empty |
void |
|
staticinherited |
Reset all database tables to default values.
bool | true if reset done, false if skipped |
Reimplemented in phpunit_util.
|
staticinherited |
Purge dataroot directory.
void |
|
staticinherited |
Reset updated table list.
This should be done after every reset.
|
staticinherited |
Set the dataroot.
It's useful when mocking the dataroot when unit testing this class itself.
string | $dataroot | the dataroot of the test framework. |
|
staticinherited |
Set state of modified tables.
string | $sql | sql which is updating the table. |
|
staticprotectedinherited |
Skip the original dataroot files to not been reset.
string | $utilclassname | the util class name.. |
|
static |
Enables test mode.
It uses CFG->behat_dataroot
Starts the test mode checking the composer installation and the test environment and updating the available features and steps definitions.
Stores a file in dataroot/behat to allow Moodle to switch to the test environment when using cli-server.
bool | $themesuitewithallfeatures | List themes to include core features. |
string | $tags | comma separated tag, which will be given preference while distributing features in parallel run. |
int | $parallelruns | number of parallel runs. |
int | $run | current run. |
coding_exception |
void |
|
static |
|
staticprotectedinherited |
Stores the status of the database.
Serializes the contents and the structure and stores it in the test framework space in dataroot
|
staticprotected |
Checks whether the test database and dataroot is ready Stops execution if something went wrong.
coding_exception |
void |