Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
A class for recording the definition of Mink replacements for use in Mink selectors. More...
Public Member Functions | |
__construct (string $from, string $to) | |
Create the replacement. | |
get_from (string $component) | |
Get the 'from' part of the replacement, formatted for the component. | |
get_to () | |
Get the 'to' part of the replacement. | |
Protected Attributes | |
string | $from |
string | $to |
A class for recording the definition of Mink replacements for use in Mink selectors.
These are comprised of a source string, and a replacement.
During use the source string is converted from the string to be in the format:
%[component]/[string]%
For example:
%mod_forum/title%
Mink replacements are used in xpath translation to translate regularly used items such as title. Here is an example from the upstream Mink project:
'tagTextMatch' => 'contains(normalize-space(string(.)), locator%)'
And can be used in an xpath:
.//label[%tagTextMatch%]
This would be expanded to:
.//label[contains(normalize-space(string(.)), %locator%)]
Replacements can also be used in other replacements, as long as that replacement is defined later.
'%linkMatch%' => '(%idMatch% or %tagTextMatch% or %titleMatch% or %relMatch%)'
behat_component_named_replacement::__construct | ( | string | $from, |
string | $to ) |
Create the replacement.
string | $from | this is the old selector that should no longer be used. For example 'group_message'. |
string | $to | this is the new equivalent that should be used instead. For example 'core_message > Message'. |
behat_component_named_replacement::get_from | ( | string | $component | ) |
Get the 'from' part of the replacement, formatted for the component.
string | $component |
string |
behat_component_named_replacement::get_to | ( | ) |
Get the 'to' part of the replacement.
string | Target xpath |