Merge branch 'MDL-77691-311' of https://github.com/roland04/moodle into MOODLE_311_STABLE
This commit is contained in:
@@ -144,9 +144,7 @@ Feature: Manage plan workflow
|
||||
| name | user | description | status | reviewer |
|
||||
| Test-Plan3 | user1 | Description of plan 3 for user 1 | active | manager1 |
|
||||
| Test-Plan4 | user1 | Description of plan 4 for user 1 | active | manager1 |
|
||||
And I log in as "manager1"
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
And I follow "User 1"
|
||||
And I am on the "user1" "user > profile" page logged in as "manager1"
|
||||
And I follow "Learning plans"
|
||||
And I should see "List of learning plans"
|
||||
And I follow "Learning plans"
|
||||
@@ -163,9 +161,7 @@ Feature: Manage plan workflow
|
||||
| name | user | description | status | reviewer |
|
||||
| Test-Plan3 | user1 | Description of plan 3 for user 1 | active | manager1 |
|
||||
| Test-Plan4 | user1 | Description of plan 4 for user 1 | active | manager1 |
|
||||
And I log in as "manager1"
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
And I follow "User 1"
|
||||
And I am on the "user1" "user > profile" page logged in as "manager1"
|
||||
And I follow "Learning plans"
|
||||
And I should see "List of learning plans"
|
||||
And I follow "Learning plans"
|
||||
@@ -185,9 +181,7 @@ Feature: Manage plan workflow
|
||||
| name | user | description | status | reviewer |
|
||||
| Test-Plan3 | user1 | Description of plan 3 for user 1 | complete | manager1 |
|
||||
| Test-Plan4 | user1 | Description of plan 4 for user 1 | complete | manager1 |
|
||||
And I log in as "manager1"
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
And I follow "User 1"
|
||||
And I am on the "user1" "user > profile" page logged in as "manager1"
|
||||
And I follow "Learning plans"
|
||||
And I should see "List of learning plans"
|
||||
And I follow "Learning plans"
|
||||
|
||||
@@ -241,9 +241,7 @@ Feature: Viewing acceptances reports and accepting on behalf of other users
|
||||
And I set the field "I agree to the This site policy" to "1"
|
||||
And I press "Next"
|
||||
And I log out
|
||||
And I log in as "admin"
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
And I follow "Manager"
|
||||
And I am on the "manager" "user > profile" page logged in as "admin"
|
||||
And I follow "Log in as"
|
||||
And I press "Continue"
|
||||
And I navigate to "Users > Privacy and policies > Manage policies" in site administration
|
||||
|
||||
@@ -562,9 +562,7 @@ Feature: User must accept policy managed by this plugin when logging in and sign
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| user1 | User | 1 | user1@example.com |
|
||||
When I log in as "admin"
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
And I follow "User 1"
|
||||
When I am on the "user1" "user > profile" page logged in as "admin"
|
||||
And I follow "Log in as"
|
||||
Then I should see "You are logged in as User 1"
|
||||
And I press "Continue"
|
||||
@@ -603,8 +601,7 @@ Feature: User must accept policy managed by this plugin when logging in and sign
|
||||
And I set the field "I agree to the This site policy" to "1"
|
||||
And I set the field "I agree to the This privacy policy" to "1"
|
||||
And I press "Next"
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
And I follow "User 1"
|
||||
And I am on the "user1" "user > profile" page
|
||||
And I follow "Log in as"
|
||||
Then I should see "You are logged in as User 1"
|
||||
And I press "Continue"
|
||||
|
||||
@@ -1685,4 +1685,30 @@ EOF;
|
||||
|
||||
return !empty($matches);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user id from an identifier.
|
||||
*
|
||||
* The user username and email fields are checked.
|
||||
*
|
||||
* @param string $identifier The user's username or email.
|
||||
* @return int|null The user id or null if not found.
|
||||
*/
|
||||
protected function get_user_id_by_identifier(string $identifier): ?int {
|
||||
global $DB;
|
||||
|
||||
$sql = <<<EOF
|
||||
SELECT id
|
||||
FROM {user}
|
||||
WHERE username = :username
|
||||
OR email = :email
|
||||
EOF;
|
||||
|
||||
$result = $DB->get_field_sql($sql, [
|
||||
'username' => $identifier,
|
||||
'email' => $identifier,
|
||||
]);
|
||||
|
||||
return $result ?: null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,7 @@ Feature: To be able to see and save user message preferences as admin
|
||||
And I navigate to "Messaging > Notification settings" in site administration
|
||||
And I set the field "email" to "1"
|
||||
And I press "Save changes"
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
And I click on "Student 1" "link" in the "Student 1" "table_row"
|
||||
And I am on the "student1" "user > profile" page
|
||||
And I click on "Preferences" "link" in the "#region-main-box" "css_element"
|
||||
And I click on "Message preferences" "link" in the "#region-main-box" "css_element"
|
||||
And I click on "//label[@data-state='loggedoff']" "xpath_element"
|
||||
|
||||
@@ -84,4 +84,29 @@ class behat_user extends behat_base {
|
||||
throw new ExpectationException('The "' . $field . '" field does have purpose "' . $purpose . '"', $this->getSession());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert page names to URLs for steps like 'When I am on the "[identifier]" "[page type]" page'.
|
||||
*
|
||||
* Recognised page names are:
|
||||
* | Page Type | Identifier meaning | Description |
|
||||
* | profile | username or email | User profile page (/user/profile.php) |
|
||||
*
|
||||
* @param string $type identifies which type of page this is, e.g. 'Editing'.
|
||||
* @param string $identifier identifies the user, e.g. 'student1'.
|
||||
* @return moodle_url the corresponding URL.
|
||||
* @throws Exception with a meaningful error message if the specified page cannot be found.
|
||||
*/
|
||||
protected function resolve_page_instance_url(string $type, string $identifier): moodle_url {
|
||||
switch (strtolower($type)) {
|
||||
case 'profile':
|
||||
$userid = $this->get_user_id_by_identifier($identifier);
|
||||
if (!$userid) {
|
||||
throw new Exception('The specified user with username or email "' . $identifier . '" does not exist');
|
||||
}
|
||||
return new moodle_url('/user/profile.php', ['id' => $userid]);
|
||||
default:
|
||||
throw new Exception("Unrecognised page type '{$type}'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,8 +76,7 @@ Feature: The student can navigate to their grades page and user grade report.
|
||||
| moodle/user:viewuseractivitiesreport | 1 |
|
||||
| moodle/user:viewdetails | 1 |
|
||||
And I click on "Create this role" "button"
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
And I follow "Student 1"
|
||||
And I am on the "student1" "user > profile" page
|
||||
And I click on "Preferences" "link" in the ".profile_tree" "css_element"
|
||||
And I follow "Assign roles relative to this user"
|
||||
And I follow "Parent"
|
||||
|
||||
@@ -68,8 +68,7 @@ Feature: Access to preferences page
|
||||
| moodle/user:viewuseractivitiesreport | 1 |
|
||||
| moodle/user:viewdetails | 1 |
|
||||
And I click on "Create this role" "button"
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
And I follow "Student 1"
|
||||
And I am on the "student1" "user > profile" page
|
||||
And I click on "Preferences" "link" in the ".profile_tree" "css_element"
|
||||
And I follow "Assign roles relative to this user"
|
||||
And I follow "Parent"
|
||||
|
||||
Reference in New Issue
Block a user