Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Public Attributes | List of all members
behat_permissions Class Reference
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. More...
 
 getSession ($name=null)
 Returns the Mink session. More...
 
 i_define_the_allowed_role_assignments_for_a_role_as ($rolename, $table)
 Set the allowed role assignments for the specified role. More...
 
 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. More...
 
 i_fill_the_capabilities_form_with_the_following_permissions ($table)
 Fills the advanced permissions form with the provided data. More...
 
 i_override_the_system_permissions_of_role_with ($rolename, $table)
 Overrides system capabilities at category, course and module levels. More...
 
 i_set_the_following_system_permissions_of_role ($rolename, $table)
 Set system level permissions to the specified role. More...
 
 the_context_is_context_frozen (string $element, string $selector)
 Mark context as frozen. More...
 
 the_context_is_not_context_frozen (string $element, string $selector)
 Unmark context as frozen. More...
 

Public Attributes

const EXTENDED_TIMEOUT = 10
 And extended timeout for specific cases. More...
 
const PAGE_READY_JS
 The JS code to check that the page is ready. More...
 
const REDUCED_TIMEOUT = 2
 Small timeout. More...
 
const TIMEOUT = 6
 The timeout for each Behat step (load page, wait for an element to load...). More...
 

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

◆ EXTENDED_TIMEOUT

const behat_session_interface::EXTENDED_TIMEOUT = 10
inherited

And extended timeout for specific cases.

Deprecated:
since Moodle 3.7 MDL-64979 - please use get_extended_timeout() instead
Todo:
MDL-64982 This will be deleted in Moodle 3.11
See also
behat_base::get_extended_timeout()

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

◆ REDUCED_TIMEOUT

const behat_session_interface::REDUCED_TIMEOUT = 2
inherited

Small timeout.

A reduced timeout for cases where self::TIMEOUT is too much and a simple $this->getSession()->getPage()->find() could not be enough.

Deprecated:
since Moodle 3.7 MDL-64979 - please use get_reduced_timeout() instead
Todo:
MDL-64982 This will be deleted in Moodle 3.11
See also
behat_base::get_reduced_timeout()

◆ TIMEOUT

const behat_session_interface::TIMEOUT = 6
inherited

The timeout for each Behat step (load page, wait for an element to load...).

Deprecated:
since Moodle 3.7 MDL-64979 - please use get_timeout() instead
Todo:
MDL-64982 This will be deleted in Moodle 3.11
See also
behat_base::get_timeout()

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