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

Steps definitions related with admin presets. More...

Inheritance diagram for behat_admin_presets:
behat_base behat_session_interface

Public Member Functions

 download_file_from_link_within_node (string $selectortype, string $link, string $nodeselectortype, string $nodeelement)
 Given the text of a link, download the linked file and return the contents.
 
 following_in_the_should_download_between_and_bytes (string $link, string $selectortype, string $nodeelement, string $nodeselectortype, int $minexpectedsize, int $maxexpectedsize)
 Downloads the file from a specific link on the page and checks the size is in a given range.
 
 getSession ($name=null)
 Returns the Mink session.
 

Public Attributes

const PAGE_READY_JS
 The JS code to check that the page is ready.
 

Detailed Description

Steps definitions related with admin presets.

Author
Sylvain Revenu | Pimenko
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Author
Sylvain Revenu | Pimenko
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ download_file_from_link_within_node()

behat_admin_presets::download_file_from_link_within_node ( string $selectortype,
string $link,
string $nodeselectortype,
string $nodeelement )
final

Given the text of a link, download the linked file and return the contents.

This is a helper method used by {

See also
following_in_the_should_download_between_and_bytes()}
Parameters
string$selectortypeThe type of what we look for
string$linkthe text of the link.
string$nodeselectortypeThe type of selector where we look in
string$nodeelementElement we look in
Return values
stringthe content of the downloaded file.

◆ following_in_the_should_download_between_and_bytes()

behat_admin_presets::following_in_the_should_download_between_and_bytes ( string $link,
string $selectortype,
string $nodeelement,
string $nodeselectortype,
int $minexpectedsize,
int $maxexpectedsize )
final

Downloads the file from a specific link on the page and checks the size is in a given range.

Only works if the link has an href attribute. Javascript downloads are not supported. Currently, the href must be an absolute URL.

The range includes the endpoints. That is, a 10 byte file in considered to be between "5" and "10" bytes, and between "10" and "20" bytes.

@Then /^following "(?P<link_string>[^"]*)" "(?P<selector_string>[^"]*)" in the "(?P<element_container_string>(?:[^"]|::")*)" "(?P<text_selector_string>[^"]*)" should download between "(?P<min_bytes>\d+)" and "(?P<max_bytes>\d+)" bytes$/

Parameters
string$linkthe text of the link.
string$selectortypeThe type of what we look for
string$nodeelementElement we look in
string$nodeselectortypeThe type of selector where we look in
int$minexpectedsizethe minimum expected file size in bytes.
int$maxexpectedsizethe maximum expected file size in bytes.
Return values
void
Exceptions
ExpectationException

◆ getSession()

behat_session_interface::getSession ( $name = null)
inherited

Returns the Mink session.

Parameters
string | null$namename of the session OR active session will be used
Return values
Behat\Mink\Session

Implemented in behat_form_field.

Member Data Documentation

◆ PAGE_READY_JS

const behat_session_interface::PAGE_READY_JS
inherited
Initial value:
= "document.readyState === 'complete' && " .
"(typeof M !== 'object' || typeof M.util !== 'object' || " .
"typeof M.util.pending_js === 'undefined' || M.util.pending_js.length === 0)"

The JS code to check that the page is ready.

The document must be complete and either M.util.pending_js must be empty, or it must not be defined at all.


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