Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

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

Behat command utils

Copyright: 2012 David MonllaĆ³
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 278 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

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

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

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.
return: string

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

Execution continues when the process finishes

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

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.

param: string $msg
return: void