Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

Behat command utils

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