Search moodle.org's
Developer Documentation

  • Bug fixes for general core bugs in 3.11.x will end 9 May 2022 (12 months).
  • Bug fixes for security issues in 3.11.x will end 14 November 2022 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
  • /lib/behat/ -> lib.php (source)

    Differences Between: [Versions 310 and 311] [Versions 35 and 311] [Versions 36 and 311] [Versions 37 and 311] [Versions 38 and 311] [Versions 39 and 311]

    Behat basic functions It does not include MOODLE_INTERNAL because is part of the bootstrap.

    Copyright: 2012 David MonllaĆ³
    License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
    File Size: 550 lines (20 kb)
    Included or required: 9 times
    Referenced: 0 times
    Includes or requires: 1 file
     lib/testing/lib.php

    Defines 12 functions


    Functions that are not part of a class:

    behat_error($errorcode, $text = '')   X-Ref
    Exits with an error code

    return: void Stops execution with error code
    param: mixed $errorcode
    param: string $text

    behat_get_error_string($errtype)   X-Ref
    Return logical error string.

    return: string string which will be returned.
    param: int $errtype php error type.

    behat_error_handler($errno, $errstr, $errfile, $errline)   X-Ref
    PHP errors handler to use when running behat tests.

    Adds specific CSS classes to identify
    the messages.

    return: bool
    param: int $errno
    param: string $errstr
    param: string $errfile
    param: int $errline

    behat_shutdown_function()   X-Ref
    Before shutdown save last error entries, so we can fail the test.


    behat_get_shutdown_process_errors()   X-Ref
    Return php errors save which were save during shutdown.

    return: array

    behat_clean_init_config()   X-Ref
    Restrict the config.php settings allowed.

    When running the behat features the config.php
    settings should not affect the results.

    return: void

    behat_check_config_vars()   X-Ref
    Checks that the behat config vars are properly set.

    return: void Stops execution with error code if something goes wrong.

    behat_is_test_site()   X-Ref
    Should we switch to the test site data?

    return: bool

    behat_update_vars_for_process()   X-Ref
    Fix variables for parallel behat testing.
    - behat_wwwroot = behat_wwwroot{behatrunprocess}
    - behat_dataroot = behat_dataroot{behatrunprocess}
    - behat_prefix = behat_prefix.{behatrunprocess}_ (For oracle it will be firstletter of prefix and behatrunprocess)


    behat_is_requested_url($url)   X-Ref
    Checks if the URL requested by the user matches the provided argument

    return: bool Returns true if it matches.
    param: string $url

    behat_get_run_process()   X-Ref
    Get behat run process from either $_SERVER or command config.

    return: bool|int false if single run, else run process number.

    cli_execute_parallel($cmds, $cwd = null, $delay = 0)   X-Ref
    Execute commands in parallel.

    return: array list of processes.
    param: array $cmds list of commands to be executed.
    param: string $cwd absolute path of working directory.
    param: int $delay time in seconds to add delay between each parallel process.