Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

Behat command utils

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

Defines 1 class

behat_command:: (7 methods):
  get_parent_behat_dir()
  get_behat_dir()
  get_behat_command()
  run()
  behat_setup_problem()
  are_behat_dependencies_installed()
  output_msg()


Class: behat_command  - X-Ref

Behat command related utils

get_parent_behat_dir()   X-Ref
Ensures the behat dir exists in moodledata

return: string Full path

get_behat_dir($runprocess = 0)   X-Ref
Ensures the behat dir exists in moodledata

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

get_behat_command($custombyterm = false, $parallerun = false, $absolutepath = false)   X-Ref
Returns the executable path

Allows returning a customized command for cygwin when the
command is just displayed, when using exec(), system() and
friends we stay with DIRECTORY_SEPARATOR as they use the
normal cmd.exe (in Windows).

return: string
param: bool $custombyterm  If the provided command should depend on the terminal where it runs
param: bool $parallelrun If parallel run is installed.
param: bool $absolutepath return command with absolute path.

run($options = '')   X-Ref
Runs behat command with provided options

Execution continues when the process finishes

return: array            CLI command outputs [0] => string, [1] => integer
param: string $options  Defaults to '' so tests would be executed

behat_setup_problem()   X-Ref
Checks if behat is set up and working

Notifies failures both from CLI and web interface.

It checks behat dependencies have been installed and runs
the behat help command to ensure it works as expected

return: int Error code or 0 if all ok

are_behat_dependencies_installed()   X-Ref
Has the site installed composer.

return: bool

output_msg($msg)   X-Ref
Outputs a message.

Used in CLI + web UI methods. Stops the
execution in web.

return: void
param: string $msg