Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
behat_context_helper Class Reference

Helper to get behat contexts. More...

Static Public Member Functions

static escape ($label)
 Translates string to XPath literal.
 
static get ($classname)
 Gets the required context.
 
static get_component_context (string $component)
 Get the context for the specified component or subsystem.
 
static get_prefixed_contexts (string $prefix)
 Find all Behat contexts which match the specified context class name prefix.
 
static has_context (string $classname)
 Return whether there is a context of the specified classname.
 
static set_environment (Environment $environment)
 Sets behat environment.
 

Static Protected Member Functions

static get_theme_override (string $classname)
 Check for any theme override of the specified class name.
 

Static Protected Attributes

static Environment $environment = null
 Behat environment.
 
static Escaper::escapeLiteral $escaper
 
static array $nonexistingcontexts = array()
 keep track of nonexisting contexts, to avoid exception tracking.
 

Detailed Description

Helper to get behat contexts.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ escape()

static behat_context_helper::escape ( $label)
static

Translates string to XPath literal.

Parameters
string$labellabel to escape
Return values
stringescaped string.

◆ get()

static behat_context_helper::get ( $classname)
static

Gets the required context.

Getting a context you get access to all the steps that uses direct API calls; steps returning step chains can not be executed like this.

Exceptions
Behat\Behat\Context\Exception\ContextNotFoundException
Parameters
string$classnameContext identifier (the class name).
Return values
behat_base

◆ get_component_context()

static behat_context_helper::get_component_context ( string $component)
static

Get the context for the specified component or subsystem.

Parameters
string$componentThe component or subsystem to find the context for
Return values
behat_base|null

◆ get_prefixed_contexts()

static behat_context_helper::get_prefixed_contexts ( string $prefix)
static

Find all Behat contexts which match the specified context class name prefix.

Moodle uses a consistent class naming scheme for all Behat contexts, whereby the context name is in the format:

behat_{component}

This method will return all contexts which match the specified prefix.

For example, to find all editors, you would pass in 'behat_editor', and this might return:

Parameters
string$prefixThe prefix to search for
Return values
Behat\Behat\Context\Context[]

◆ get_theme_override()

static behat_context_helper::get_theme_override ( string $classname)
staticprotected

Check for any theme override of the specified class name.

Parameters
string$classname
Return values
string|null

◆ has_context()

static behat_context_helper::has_context ( string $classname)
static

Return whether there is a context of the specified classname.

Parameters
string$classname
Return values
bool

◆ set_environment()

static behat_context_helper::set_environment ( Environment $environment)
static

Sets behat environment.

Parameters
Environment$environment
Return values
void

The documentation for this class was generated from the following file: