Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
Directories | |
directory | extension |
| |
directory | features |
| |
Classes | |
class | base_testcase |
Base test case class. More... | |
class | behat_accessibility |
Steps definitions to assist with accessibility testing. More... | |
class | behat_action_menu |
Steps definitions to open and close action menus. More... | |
class | behat_base |
Base class of all steps definitions. More... | |
class | behat_command |
Behat command related utils. More... | |
class | behat_component_named_replacement |
A class for recording the definition of Mink replacements. More... | |
class | behat_component_named_selector |
Class representing a named selector that can be used in Behat tests. More... | |
class | behat_config_manager |
Behat configuration manager. More... | |
class | behat_context_helper |
Helper to get behat contexts. More... | |
class | behat_data_generators |
Data generators for acceptance testing. More... | |
class | behat_deprecated |
Steps definitions that are now deprecated and will be removed in the next releases. More... | |
class | behat_deprecated_base |
Base class for steps definitions classes that contain deprecated steps. More... | |
class | behat_exact_named_selector |
Moodle-specific named exact selectors. More... | |
class | behat_field_manager |
Form fields helper. More... | |
class | behat_filters |
Steps definitions related to filters. More... | |
class | behat_init_context |
Loads main subcontexts. More... | |
class | behat_login |
Behat login related steps definitions. More... | |
class | behat_moodlenet |
Steps definitions related to MoodleNet. More... | |
class | behat_navigation |
Steps definitions to navigate through the navigation tree nodes. More... | |
class | behat_partial_named_selector |
Moodle-specific selectors. More... | |
class | behat_permissions |
Steps definitions related with permissions. More... | |
class | behat_selectors |
Moodle selectors manager. More... | |
interface | behat_session_interface |
The Interface for a behat root context. More... | |
class | behat_transformations |
Transformations to apply to steps arguments. More... | |
class | behat_util |
Init/reset utilities for Behat database and dataroot. More... | |
class | component_generator_base |
Component generator base class. More... | |
class | default_block_generator |
Default block generator class. More... | |
class | mod_chat_generator |
mod_chat data generator class. More... | |
class | nasty_strings |
Nasty strings manager. More... | |
class | phpunit_dataset |
Lightweight dataset class for phpunit, supports XML, CSV and array datasets. More... | |
class | restore_date_testcase |
Advanced PHPUnit test case customised for testing restore dates in Moodle. More... | |
class | test_lock |
Tests lock. More... | |
class | testing_block_generator |
Block generator base class. More... | |
class | testing_module_generator |
Module generator base class. More... | |
class | testing_util |
Testing util classes. More... | |
class | tests_finder |
Tests finder. More... | |
Functions | |
behat_check_config_vars () | |
Checks that the behat config vars are properly set. | |
behat_clean_init_config () | |
Restrict the config.php settings allowed. | |
behat_error ($errorcode, $text='') | |
Exits with an error code. | |
behat_error_handler ($errno, $errstr, $errfile, $errline) | |
PHP errors handler to use when running behat tests. | |
behat_get_command_flags (string $option, $value) | |
Get command flags for an option/value combination. | |
behat_get_error_string ($errtype) | |
Return logical error string. | |
behat_get_run_process () | |
Get behat run process from either $_SERVER or command config. | |
behat_get_shutdown_process_errors () | |
Return php errors save which were save during shutdown. | |
behat_is_requested_url ($url) | |
Checks if the URL requested by the user matches the provided argument. | |
behat_is_test_site () | |
Should we switch to the test site data? | |
behat_shutdown_function () | |
Before shutdown save last error entries, so we can fail the test. | |
behat_update_vars_for_process () | |
Fix variables for parallel behat testing. | |
cli_execute_parallel ($cmds, $cwd=null, $delay=0) | |
Execute commands in parallel. | |
testing_cli_argument_path ($moodlepath) | |
Returns relative path against current working directory, to be used for shell execution hints. | |
testing_cli_fix_directory_separator ($path) | |
Fix DIRECTORY_SEPARATOR for windows. | |
testing_error ($errorcode, $text='') | |
Prints an error and stops execution. | |
testing_fix_file_permissions ($file) | |
Try to change permissions to $CFG->dirroot or $CFG->dataroot if possible. | |
testing_initdataroot ($dataroot, $framework) | |
Mark empty dataroot to be used for testing. | |
testing_is_cygwin () | |
Find out if running under Cygwin on Windows. | |
testing_is_mingw () | |
Returns whether a mingw CLI is running. | |
testing_update_composer_dependencies (bool $selfupdate=true, bool $updatedependencies=true) | |
Perform necessary steps to install and/or upgrade composer and its dependencies. | |
Variables | |
const | BEHAT_EXITCODE_CONFIG 250 |
Behat basic functions. | |
const | BEHAT_EXITCODE_INSTALL 254 |
const | BEHAT_EXITCODE_INSTALLED 256 |
const | BEHAT_EXITCODE_PERMISSIONS 252 |
const | BEHAT_EXITCODE_REINSTALL 253 |
const | BEHAT_EXITCODE_REQUIREMENT 251 |
const | BEHAT_PARALLEL_SITE_NAME "behatrun" |
The behat test site fullname and shortname. | |
const | TESTING_EXITCODE_COMPOSER 255 |
Testing general functions. | |
behat_check_config_vars | ( | ) |
Checks that the behat config vars are properly set.
void | Stops execution with error code if something goes wrong. |
behat_clean_init_config | ( | ) |
Restrict the config.php settings allowed.
When running the behat features the config.php settings should not affect the results.
void |
behat_error | ( | $errorcode, | |
$text = '' ) |
Exits with an error code.
mixed | $errorcode | |
string | $text |
void | Stops execution with error code |
behat_error_handler | ( | $errno, | |
$errstr, | |||
$errfile, | |||
$errline ) |
PHP errors handler to use when running behat tests.
Adds specific CSS classes to identify the messages.
int | $errno | |
string | $errstr | |
string | $errfile | |
int | $errline |
bool |
behat_get_command_flags | ( | string | $option, |
$value ) |
Get command flags for an option/value combination.
string | $option | |
string | bool | null | $value |
string |
behat_get_error_string | ( | $errtype | ) |
Return logical error string.
int | $errtype | php error type. |
string | string which will be returned. |
behat_get_run_process | ( | ) |
Get behat run process from either $_SERVER or command config.
bool|int | false if single run, else run process number. |
behat_get_shutdown_process_errors | ( | ) |
Return php errors save which were save during shutdown.
array |
behat_is_requested_url | ( | $url | ) |
Checks if the URL requested by the user matches the provided argument.
string | $url |
bool | Returns true if it matches. |
behat_is_test_site | ( | ) |
Should we switch to the test site data?
bool |
behat_update_vars_for_process | ( | ) |
Fix variables for parallel behat testing.
cli_execute_parallel | ( | $cmds, | |
$cwd = null, | |||
$delay = 0 ) |
Execute commands in parallel.
array | $cmds | list of commands to be executed. |
string | $cwd | absolute path of working directory. |
int | $delay | time in seconds to add delay between each parallel process. |
array | list of processes. |
testing_cli_argument_path | ( | $moodlepath | ) |
Returns relative path against current working directory, to be used for shell execution hints.
string | $moodlepath | starting with "/", ex: "/admin/tool/cli/init.php" |
string | path relative to current directory or absolute path |
testing_cli_fix_directory_separator | ( | $path | ) |
Fix DIRECTORY_SEPARATOR for windows.
In PHP on Windows, DIRECTORY_SEPARATOR is set to the backslash (::) character. However, if you're running a Cygwin/Msys/Git shell exec() calls will return paths using the forward slash (/) character.
NOTE: Because PHP on Windows will accept either forward or backslashes, paths should be built using ONLY forward slashes, regardless of OS. MOODLE_DIRECTORY_SEPARATOR should only be used when parsing paths returned by the shell.
string | $path |
string |
testing_error | ( | $errorcode, | |
$text = '' ) |
Prints an error and stops execution.
integer | $errorcode | |
string | $text |
void | exits |
testing_fix_file_permissions | ( | $file | ) |
Try to change permissions to $CFG->dirroot or $CFG->dataroot if possible.
string | $file |
bool | success |
testing_initdataroot | ( | $dataroot, | |
$framework ) |
Mark empty dataroot to be used for testing.
string | $dataroot | The dataroot directory |
string | $framework | The test framework |
void |
testing_is_cygwin | ( | ) |
Find out if running under Cygwin on Windows.
bool |
testing_is_mingw | ( | ) |
Returns whether a mingw CLI is running.
MinGW sets $_SERVER['TERM'] to cygwin, but it can not run .bat files; this function may be useful when we need to output proposed commands to users using Windows CLI interfaces.
@externalurl http://sourceforge.net/p/mingw/bugs/1902
bool |
testing_update_composer_dependencies | ( | bool | $selfupdate = true, |
bool | $updatedependencies = true ) |
Perform necessary steps to install and/or upgrade composer and its dependencies.
Installation is mandatory, but upgrade is optional.
Note: This function does not return, but will call exit()
on error.
bool | $selfupdate | Perform a composer self-update to update the composer.phar utility |
bool | $updatedependencies | Upgrade dependencies |
const BEHAT_EXITCODE_CONFIG 250 |
Behat basic functions.
It does not include MOODLE_INTERNAL because is part of the bootstrap.
This script should not be usually included, neither any of its functions used, within mooodle code at all. It's for exclusive use of behat and moodle setup.php. For places requiring a different/special behavior needing to check if are being run as part of behat tests, use: if (defined('BEHAT_SITE_RUNNING')) { ...
const TESTING_EXITCODE_COMPOSER 255 |
Testing general functions.
Note: these functions must be self contained and must not rely on any library or include