Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
behat_permissions Class Reference

Steps definitions to set up permissions to capabilities. More...

Inheritance diagram for behat_permissions:
behat_base behat_session_interface

Public Member Functions

 capability_has_permission ($capabilityname, $permission)
 Checks if the capability has the specified permission.
 
 getSession ($name=null)
 Returns the Mink session.
 
 i_define_the_allowed_role_assignments_for_a_role_as ($rolename, $table)
 Set the allowed role assignments for the specified role.
 
 i_fill_in_the_allowed_role_assignments_form_for_a_role_with ($sourcerole, $table)
 Fill in the allowed role assignments form for the specied role.
 
 i_fill_the_capabilities_form_with_the_following_permissions ($table)
 Fills the advanced permissions form with the provided data.
 
 i_override_the_system_permissions_of_role_with ($rolename, $table)
 Overrides system capabilities at category, course and module levels.
 
 i_set_the_following_system_permissions_of_role ($rolename, $table)
 Set system level permissions to the specified role.
 
 the_context_is_context_frozen (string $element, string $selector)
 Mark context as frozen.
 
 the_context_is_not_context_frozen (string $element, string $selector)
 Unmark context as frozen.
 

Public Attributes

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

Detailed Description

Steps definitions to set up permissions to capabilities.

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

Member Function Documentation

◆ capability_has_permission()

behat_permissions::capability_has_permission ( $capabilityname,
$permission )

Checks if the capability has the specified permission.

Works in the role definition advanced page.

@Then /^"(?P<capability_string>(?:[^"]|::")*)" capability has "(?P<permission_string>Not set|Allow|Prevent|Prohibit)" permission$/

Exceptions
ExpectationException
Parameters
string$capabilityname
string$permission
Return values
void

◆ 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.

◆ i_define_the_allowed_role_assignments_for_a_role_as()

behat_permissions::i_define_the_allowed_role_assignments_for_a_role_as ( $rolename,
$table )

Set the allowed role assignments for the specified role.

@Given /^I define the allowed role assignments for the "(?P<rolefullname_string>(?:[^"]|::")*)" role as:$/

Parameters
string$rolename
TableNode$table
Return values
voidExecutes other steps

◆ i_fill_in_the_allowed_role_assignments_form_for_a_role_with()

behat_permissions::i_fill_in_the_allowed_role_assignments_form_for_a_role_with ( $sourcerole,
$table )

Fill in the allowed role assignments form for the specied role.

Takes a table with two columns. Each row should contain the target role, and either "Assignable" or "Not assignable".

@Given /^I fill in the allowed role assignments form for the "(?P<rolefullname_string>(?:[^"]|::")*)" role with:$/

Parameters
String$sourcerole
TableNode$table
Return values
void

◆ i_fill_the_capabilities_form_with_the_following_permissions()

behat_permissions::i_fill_the_capabilities_form_with_the_following_permissions ( $table)

Fills the advanced permissions form with the provided data.

Expects a table with capability name and permission (Inherit/Allow/Prevent/Prohibit) columns. @Given /^I fill the capabilities form with the following permissions:$/

Parameters
TableNode$table
Return values
void

◆ i_override_the_system_permissions_of_role_with()

behat_permissions::i_override_the_system_permissions_of_role_with ( $rolename,
$table )

Overrides system capabilities at category, course and module levels.

This step begins after clicking 'Permissions' link. Expects a table with capability name and permission (Inherit/Allow/Prevent/Prohibit) columns. @Given /^I override the system permissions of "(?P<rolefullname_string>(?:[^"]|::")*)" role with:$/

Parameters
string$rolename
TableNode$table

◆ i_set_the_following_system_permissions_of_role()

behat_permissions::i_set_the_following_system_permissions_of_role ( $rolename,
$table )

Set system level permissions to the specified role.

Expects a table with capability name and permission (Inherit/Allow/Prevent/Prohibit) columns. @Given /^I set the following system permissions of "(?P<rolefullname_string>(?:[^"]|::")*)" role:$/

Parameters
string$rolename
TableNode$table

◆ the_context_is_context_frozen()

behat_permissions::the_context_is_context_frozen ( string $element,
string $selector )

Mark context as frozen.

@Then /^the "(?P<element_string>(?:[^"]|::")*)" "(?P<selector_string>[^"]*)" is context frozen$/

Exceptions
ExpectationExceptionif the context cannot be frozen or found
Parameters
string$elementElement we look on
string$selectorThe type of where we look (activity, course)

◆ the_context_is_not_context_frozen()

behat_permissions::the_context_is_not_context_frozen ( string $element,
string $selector )

Unmark context as frozen.

@Then /^the "(?P<element_string>(?:[^"]|::")*)" "(?P<selector_string>[^"]*)" is not context frozen$/

Exceptions
ExpectationExceptionif the context cannot be frozen or found
Parameters
string$elementElement we look on
string$selectorThe type of where we look (activity, course)

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: