Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Protected Attributes | List of all members
behat_component_named_selector Class Reference

Public Member Functions

 __construct (string $alias, array $xpaths, bool $istextselector=true)
 Create the selector definition. More...
 
 get_alias (string $component)
 Get the alias of the selector. More...
 
 get_combined_xpath ()
 Get the list of combined xpaths. More...
 
 get_name (string $component)
 Get the name of the selector. More...
 
 is_text_selector ()
 Whether this is a text selector. More...
 

Protected Attributes

string $alias
 
string $istextselector
 
array $xpaths
 List of xpaths.
 

Constructor & Destructor Documentation

◆ __construct()

behat_component_named_selector::__construct ( string  $alias,
array  $xpaths,
bool  $istextselector = true 
)

Create the selector definition.

As an example, if you define new behat_component_named_selector('Message', [".//*[@data-conversation-id]//img[contains(@alt, %locator%)]/.."]) in get_partial_named_selectors in behat_message in message/tests/behat/behat_message.php, then steps like When "Group 1" "core_message > Message" should exist will work.

Text selectors are things that contain other things (e.g. some particular text), e.g. Then I can see "Some text" in the "Whatever" "text_selector" whereas non-text selectors are atomic things, like When I click the "Whatever" "widget".

Parameters
string$aliasThe 'friendly' name of the thing. This will be prefixed with the component name. For example, if the mod_mymod plugin, says 'Thingy', then "mod_mymod > Thingy" becomes a selector.
array$xpathsA list of xpaths one or more XPaths that the selector gets transformed into.
bool$istextselectorWhether this selector can also be used as a text selector.

Member Function Documentation

◆ get_alias()

behat_component_named_selector::get_alias ( string  $component)

Get the alias of the selector.

This is the human-readable name that you would typically interact with.

Parameters
string$component
Return values
string

◆ get_combined_xpath()

behat_component_named_selector::get_combined_xpath ( )

Get the list of combined xpaths.

Return values
stringThe list of xpaths combined with the xpath | (OR) operator

◆ get_name()

behat_component_named_selector::get_name ( string  $component)

Get the name of the selector.

This is a back-end feature and contains a namespaced md5 of the human-readable name.

Parameters
string$component
Return values
string

◆ is_text_selector()

behat_component_named_selector::is_text_selector ( )

Whether this is a text selector.

Return values
bool

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