Merge branch 'MDL-87523-main' of https://github.com/muhammadarnaldo/moodle
This commit is contained in:
@@ -39,7 +39,13 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
// "sitepolicies" settingpage
|
||||
$temp = new admin_settingpage('sitepolicies', new lang_string('sitepolicies', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('protectusernames', new lang_string('protectusernames', 'admin'), new lang_string('configprotectusernames', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('forcelogin', new lang_string('forcelogin', 'admin'), new lang_string('configforcelogin', 'admin'), 0));
|
||||
// Force to show the login page for fresh installs.
|
||||
$temp->add(new admin_setting_configcheckbox(
|
||||
'forcelogin',
|
||||
new lang_string('forcelogin', 'admin'),
|
||||
new lang_string('configforcelogin', 'admin'),
|
||||
1
|
||||
));
|
||||
$temp->add(new admin_setting_configcheckbox('forceloginforprofiles', new lang_string('forceloginforprofiles', 'admin'), new lang_string('configforceloginforprofiles', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('forceloginforprofileimage', new lang_string('forceloginforprofileimage', 'admin'), new lang_string('forceloginforprofileimage_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('opentowebcrawlers', new lang_string('opentowebcrawlers', 'admin'), new lang_string('configopentowebcrawlers', 'admin'), 0));
|
||||
|
||||
@@ -9,7 +9,7 @@ Feature: Verify that keyboard steps work as expected
|
||||
Given the following "users" exist:
|
||||
| username | email | firstname | lastname | password |
|
||||
| saffronr | saffron.rutledge@example.com | Saffron | Rutledge | flowerpower |
|
||||
Given I click on "Log in" "link"
|
||||
Given I am on homepage
|
||||
And I click on "Username" "field"
|
||||
When I type "saffronr"
|
||||
And I press the tab key
|
||||
@@ -19,7 +19,7 @@ Feature: Verify that keyboard steps work as expected
|
||||
|
||||
@javascript
|
||||
Scenario: Using tab changes focus to the next or previous field
|
||||
Given I click on "Log in" "link"
|
||||
Given I am on homepage
|
||||
And I click on "Username" "field"
|
||||
And the focused element is "Username" "field"
|
||||
When I press the tab key
|
||||
|
||||
@@ -9,8 +9,7 @@ Feature: User must accept policy managed by this plugin when logging in and sign
|
||||
| registerauth | email |
|
||||
| passwordpolicy | 0 |
|
||||
| sitepolicyhandler | tool_policy |
|
||||
And I am on site homepage
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
When I click on "Create new account" "link"
|
||||
Then I should not see "I understand and agree"
|
||||
And I set the following fields to these values:
|
||||
@@ -43,8 +42,7 @@ Feature: User must accept policy managed by this plugin when logging in and sign
|
||||
| Policy | Name | Revision | Content | Summary | Status |
|
||||
| P1 | This site policy | | full text1 | short text1 | draft |
|
||||
| P1 | This privacy policy | | full text2 | short text2 | draft |
|
||||
And I am on site homepage
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
When I click on "Create new account" "link"
|
||||
Then I should not see "I understand and agree"
|
||||
And I set the following fields to these values:
|
||||
@@ -78,8 +76,7 @@ Feature: User must accept policy managed by this plugin when logging in and sign
|
||||
| P1 | This site policy | | full text1 | short text1 | archived |
|
||||
| P1 | This site policy | | full text2 | short text2 | active |
|
||||
| P1 | This site policy | | full text3 | short text3 | draft |
|
||||
And I am on site homepage
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
When I click on "Create new account" "link"
|
||||
Then I should see "This site policy" in the "region-main" "region"
|
||||
And I should see "short text2"
|
||||
@@ -126,8 +123,7 @@ Feature: User must accept policy managed by this plugin when logging in and sign
|
||||
| This site policy | 0 | | full text2 | short text2 | active | all |
|
||||
| This privacy policy | 1 | | full text3 | short text3 | active | loggedin |
|
||||
| This guests policy | 0 | | full text4 | short text4 | active | guest |
|
||||
And I am on site homepage
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
When I click on "Create new account" "link"
|
||||
Then I should see "This site policy" in the "region-main" "region"
|
||||
And I should see "short text2"
|
||||
@@ -186,8 +182,7 @@ Feature: User must accept policy managed by this plugin when logging in and sign
|
||||
Given the following policies exist:
|
||||
| Name | Revision | Content | Summary | Status |
|
||||
| This site policy | | full text2 | short text2 | active |
|
||||
And I am on site homepage
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
When I click on "Create new account" "link"
|
||||
Then I should see "Age and location verification"
|
||||
And I set the field "What is your age?" to "16"
|
||||
@@ -237,8 +232,7 @@ Feature: User must accept policy managed by this plugin when logging in and sign
|
||||
| Name | Type | Revision | Content | Summary | Status | Audience |
|
||||
| This site policy | 0 | | full text2 | short text2 | active | all |
|
||||
| This privacy policy | 1 | | full text3 | short text3 | active | loggedin |
|
||||
And I am on site homepage
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
And I click on "Create new account" "link"
|
||||
And I should see "This site policy"
|
||||
And I press "Next"
|
||||
@@ -457,9 +451,8 @@ Feature: User must accept policy managed by this plugin when logging in and sign
|
||||
| This site policy | 0 | | full text2 | short text2 | active | all |
|
||||
| This privacy policy | 1 | | full text3 | short text3 | active | loggedin |
|
||||
| This guests policy | 0 | | full text4 | short text4 | active | guest |
|
||||
And I am on site homepage
|
||||
And I am on homepage
|
||||
And I change window size to "large"
|
||||
And I follow "Log in"
|
||||
When I press "Access as a guest"
|
||||
Then I should see "If you continue browsing this website, you agree to our policies"
|
||||
# Confirm when navigating, the pop-up policies are displayed.
|
||||
@@ -491,8 +484,7 @@ Feature: User must accept policy managed by this plugin when logging in and sign
|
||||
| This site policy | 0 | | full text2 | short text2 | active | all |
|
||||
| This privacy policy | 1 | | full text3 | short text3 | active | loggedin |
|
||||
| This guests policy | 0 | | full text4 | short text4 | active | guest |
|
||||
And I am on site homepage
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
When I click on "Create new account" "link"
|
||||
Then I should see "This site policy" in the "region-main" "region"
|
||||
And I should see "short text2"
|
||||
@@ -619,8 +611,7 @@ Feature: User must accept policy managed by this plugin when logging in and sign
|
||||
| P1 | This site policy | | full text1 | short text1 | archived |
|
||||
| P1 | This site policy | | full text2 | short text2 | active |
|
||||
| P1 | This site policy | | full text3 | short text3 | draft |
|
||||
And I am on site homepage
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
# First log in as a guest
|
||||
And I press "Access as a guest"
|
||||
# Now sign up
|
||||
@@ -672,8 +663,7 @@ Feature: User must accept policy managed by this plugin when logging in and sign
|
||||
| Digital maturity declaration | You declare be old enough | Here goes content. | 1 |
|
||||
| Cookies policy | We eat cookies, srsly | Here goes content. | 0 |
|
||||
| Terms of Service | We teach, you learn | Here goes content. | 1 |
|
||||
And I am on site homepage
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
When I click on "Create new account" "link"
|
||||
# The first policy with the agreement style "on its own page" must be accepted first.
|
||||
Then I should see "Digital maturity declaration" in the "region-main" "region"
|
||||
@@ -836,8 +826,7 @@ Feature: User must accept policy managed by this plugin when logging in and sign
|
||||
| Digital maturity declaration | You declare be old enough | Here goes content. | 1 | all |
|
||||
| Cookies policy | We eat cookies, srsly | Here goes content. | 1 | loggedin |
|
||||
| Terms of Service | We teach, you learn | Here goes content. | 1 | guest |
|
||||
And I am on site homepage
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
When I click on "Create new account" "link"
|
||||
# All the policies to be displayed one by one with a button to accept each of them prior seeing the next.
|
||||
Then I should see "Digital maturity declaration" in the "region-main" "region"
|
||||
|
||||
@@ -63,8 +63,7 @@ Feature: Optional policies
|
||||
| ConsentPageCompulsory1 | full text3 | short text3 | 0 | 0 |
|
||||
| OwnPageCompulsory1 | full text4 | short text4 | 1 | 0 |
|
||||
| OwnPageOptional1 | full text5 | short text5 | 1 | 1 |
|
||||
And I am on site homepage
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
And I click on "Create new account" "link"
|
||||
# Compulsory policies displayed on own page are shown first and must be agreed.
|
||||
And I should see "OwnPageCompulsory1" in the "region-main" "region"
|
||||
|
||||
@@ -345,6 +345,7 @@ final class helper_test extends \advanced_testcase {
|
||||
|
||||
public function test_resolve_category(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
$c1 = $this->getDataGenerator()->create_category(array('name' => 'First level'));
|
||||
$c2 = $this->getDataGenerator()->create_category(array('name' => 'Second level', 'parent' => $c1->id));
|
||||
@@ -379,6 +380,7 @@ final class helper_test extends \advanced_testcase {
|
||||
|
||||
public function test_resolve_category_by_idnumber(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setUser($this->getDataGenerator()->create_user());
|
||||
|
||||
$c1 = $this->getDataGenerator()->create_category(array('idnumber' => 'C1'));
|
||||
$c2 = $this->getDataGenerator()->create_category(array('idnumber' => 'C2'));
|
||||
@@ -397,6 +399,7 @@ final class helper_test extends \advanced_testcase {
|
||||
|
||||
public function test_resolve_category_by_path(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setUser($this->getDataGenerator()->create_user());
|
||||
|
||||
$cat1 = $this->getDataGenerator()->create_category(array('name' => 'Cat 1'));
|
||||
$cat1_1 = $this->getDataGenerator()->create_category(array('name' => 'Cat 1.1', 'parent' => $cat1->id));
|
||||
|
||||
@@ -49,6 +49,7 @@ final class category_filter_test extends \advanced_testcase {
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
// Create parent categories.
|
||||
$this->category1 = $this->getDataGenerator()->create_category();
|
||||
|
||||
@@ -8,8 +8,7 @@ Feature: User must accept policy when logging in and signing up
|
||||
Given the following config values are set as admin:
|
||||
| registerauth | email |
|
||||
| passwordpolicy | 0 |
|
||||
And I am on site homepage
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
When I click on "Create new account" "link"
|
||||
Then I should not see "I understand and agree"
|
||||
And I set the following fields to these values:
|
||||
@@ -38,8 +37,7 @@ Feature: User must accept policy when logging in and signing up
|
||||
| registerauth | email |
|
||||
| passwordpolicy | 0 |
|
||||
| sitepolicy | https://moodle.org |
|
||||
And I am on site homepage
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
When I click on "Create new account" "link"
|
||||
Then the field "I understand and agree" matches value "0"
|
||||
And I set the following fields to these values:
|
||||
@@ -72,8 +70,7 @@ Feature: User must accept policy when logging in and signing up
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| s1 | John | Doe | s1@example.com |
|
||||
And I am on site homepage
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
When I click on "Create new account" "link"
|
||||
And I set the following fields to these values:
|
||||
| Username | s2 |
|
||||
|
||||
@@ -8,6 +8,8 @@ Feature: Test manual authentication works.
|
||||
Given the following "users" exist:
|
||||
| username |
|
||||
| teacher1 |
|
||||
And the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
|
||||
@javascript
|
||||
Scenario: Check login works with javascript.
|
||||
|
||||
@@ -15,7 +15,6 @@ Feature: Test the 'showlogfailures' feature works.
|
||||
Scenario: Check that 'displayloginfailures' works without javascript for teachers.
|
||||
# Simulate a log in failure for the teacher.
|
||||
Given I am on homepage
|
||||
And I click on "Log in" "link" in the ".logininfo" "css_element"
|
||||
And I set the field "Username" to "teacher1"
|
||||
And I set the field "Password" to "wrongpass"
|
||||
And I press "Log in"
|
||||
@@ -36,7 +35,6 @@ Feature: Test the 'showlogfailures' feature works.
|
||||
Scenario: Check that 'displayloginfailures' works without javascript for admins.
|
||||
# Simulate a log in failure for the teacher.
|
||||
Given I am on homepage
|
||||
And I click on "Log in" "link" in the ".logininfo" "css_element"
|
||||
And I set the field "Username" to "admin"
|
||||
And I set the field "Password" to "wrongpass"
|
||||
And I press "Log in"
|
||||
|
||||
@@ -17,8 +17,7 @@ Feature: Authentication
|
||||
Given the following "users" exist:
|
||||
| username | password | firstname | lastname | email |
|
||||
| testuser | testuser | Test | User | moodle@example.com |
|
||||
And I am on site homepage
|
||||
When I follow "Log in"
|
||||
And I am on homepage
|
||||
And I set the field "Username" to "testuser"
|
||||
And I set the field "Password" to "testuser"
|
||||
And I press "Log in"
|
||||
@@ -28,8 +27,7 @@ Feature: Authentication
|
||||
Given the following "users" exist:
|
||||
| username | password | firstname | lastname | email |
|
||||
| testuser | testuser | Test | User | moodle@example.com |
|
||||
And I am on site homepage
|
||||
When I follow "Log in"
|
||||
And I am on homepage
|
||||
And I set the field "Username" to "testuser"
|
||||
And I set the field "Password" to "unexisting"
|
||||
And I press "Log in"
|
||||
@@ -42,6 +40,8 @@ Feature: Authentication
|
||||
|
||||
@javascript @accessibility
|
||||
Scenario: Login page must be accessible
|
||||
Given the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
When I am on site homepage
|
||||
# The following tests are all provided to ensure that the accessibility tests themselves are tested.
|
||||
# In normal tests only one of the following is required.
|
||||
@@ -57,6 +57,7 @@ Feature: Authentication
|
||||
@javascript @accessibility
|
||||
Scenario: The login page must meet accessibility standards
|
||||
Given the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
| custommenuitems | -This is a custom item\|/customurl/ |
|
||||
When I am on site homepage
|
||||
Then the page should meet accessibility standards with "best-practice" extra tests
|
||||
|
||||
@@ -10,7 +10,7 @@ Feature: Test if the login form provides the correct feedback
|
||||
| teacher1 |
|
||||
|
||||
Scenario: Check invalid login message
|
||||
Given I follow "Log in"
|
||||
Given I am on homepage
|
||||
And I set the field "Username" to "teacher1"
|
||||
And I set the field "Password" to "incorrect"
|
||||
When I press "Log in"
|
||||
@@ -24,7 +24,7 @@ Feature: Test if the login form provides the correct feedback
|
||||
| es |
|
||||
And the following config values are set as admin:
|
||||
| langmenu | 1 |
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
And I open the action menu in "region-main" "region"
|
||||
# The line below contains the unicode character U+200E before and after the brackets, please be very careful editing this line.
|
||||
When I choose "Nederlands (nl)" in the open action menu
|
||||
@@ -37,13 +37,12 @@ Feature: Test if the login form provides the correct feedback
|
||||
And I upload "course/tests/fixtures/image.jpg" file to "Logo" filemanager
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
And I follow "Log in"
|
||||
Then "//img[@id='logoimage']" "xpath_element" should exist
|
||||
|
||||
Scenario: Add a custom welcome message
|
||||
Given the following config values are set as admin:
|
||||
| auth_instructions | Lorem ipsum dolor sit amet |
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
Then I should see "Lorem ipsum dolor sit amet"
|
||||
|
||||
@javascript @accessibility
|
||||
@@ -51,14 +50,14 @@ Feature: Test if the login form provides the correct feedback
|
||||
Given the following config values are set as admin:
|
||||
| maintenance_enabled | 1 |
|
||||
| maintenance_message | Back online tomorrow |
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
Then I should see "Back online tomorrow"
|
||||
And the page should meet accessibility standards with "best-practice" extra tests
|
||||
|
||||
Scenario: User self registration
|
||||
Given the following config values are set as admin:
|
||||
| registerauth | Email-based self-registration |
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
Then I should see "Create new account"
|
||||
|
||||
Scenario: Set OAuth providers
|
||||
@@ -79,7 +78,7 @@ Feature: Test if the login form provides the correct feedback
|
||||
And I set the field "Client secret" to "1234"
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
Then I should see "Google"
|
||||
And I should see "Facebook"
|
||||
And I should see "Microsoft"
|
||||
@@ -87,18 +86,18 @@ Feature: Test if the login form provides the correct feedback
|
||||
Scenario: Test the login page auto focus feature
|
||||
Given the following config values are set as admin:
|
||||
| loginpageautofocus | Enabled |
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
Then the focused element is "Username" "field"
|
||||
And I set the field "Username" to "admin"
|
||||
And I set the field "Password" to "admin"
|
||||
And I press "Log in"
|
||||
And I log out
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
Then the focused element is "Password" "field"
|
||||
|
||||
@accessibility
|
||||
Scenario: Test the login page focus after error feature
|
||||
Given I follow "Log in"
|
||||
Given I am on homepage
|
||||
And I set the field "Username" to "admin"
|
||||
And I set the field "Password" to "wrongpassword"
|
||||
And I press "Log in"
|
||||
@@ -109,7 +108,7 @@ Feature: Test if the login form provides the correct feedback
|
||||
Scenario: Display the password visibility toggle icon
|
||||
Given the following config values are set as admin:
|
||||
| loginpasswordtoggle | 1 |
|
||||
When I follow "Log in"
|
||||
And I am on homepage
|
||||
Then "Toggle sensitive" "button" should be visible
|
||||
And the following config values are set as admin:
|
||||
| loginpasswordtoggle | 0 |
|
||||
@@ -119,7 +118,7 @@ Feature: Test if the login form provides the correct feedback
|
||||
Scenario: Display the password visibility toggle icon for small screens only
|
||||
Given the following config values are set as admin:
|
||||
| loginpasswordtoggle | 2 |
|
||||
When I follow "Log in"
|
||||
And I am on homepage
|
||||
Then "Toggle sensitive" "button" should not be visible
|
||||
And I change the viewport size to "mobile"
|
||||
And "Toggle sensitive" "button" should be visible
|
||||
|
||||
@@ -15,14 +15,12 @@ Feature: Test the 'remember username' feature works.
|
||||
Given the following config values are set as admin:
|
||||
| rememberusername | 1 |
|
||||
And I am on homepage
|
||||
And I click on "Log in" "link" in the ".logininfo" "css_element"
|
||||
And I set the field "Username" to "teacher1"
|
||||
And I set the field "Password" to "teacher1"
|
||||
And I press "Log in"
|
||||
And I log out
|
||||
# Log out and check that the username was remembered.
|
||||
When I am on homepage
|
||||
And I click on "Log in" "link" in the ".logininfo" "css_element"
|
||||
Then the field "username" matches value "teacher1"
|
||||
|
||||
# Given the user has logged in before and selected 'Remember username', when they log in again and unset 'Remember username', then
|
||||
@@ -32,14 +30,12 @@ Feature: Test the 'remember username' feature works.
|
||||
Given the following config values are set as admin:
|
||||
| rememberusername | 2 |
|
||||
And I am on homepage
|
||||
And I click on "Log in" "link" in the ".logininfo" "css_element"
|
||||
And I set the field "Username" to "teacher1"
|
||||
And I set the field "Password" to "teacher1"
|
||||
And I press "Log in"
|
||||
And I log out
|
||||
# Log in again, the username should have been remembered.
|
||||
When I am on homepage
|
||||
And I click on "Log in" "link" in the ".logininfo" "css_element"
|
||||
Then the field "username" matches value "teacher1"
|
||||
And I set the field "Password" to "teacher1"
|
||||
And I press "Log in"
|
||||
@@ -48,5 +44,4 @@ Feature: Test the 'remember username' feature works.
|
||||
| rememberusername | 0 |
|
||||
# Check username has been forgotten.
|
||||
And I am on homepage
|
||||
And I click on "Log in" "link" in the ".logininfo" "css_element"
|
||||
Then the field "username" matches value ""
|
||||
|
||||
@@ -12,7 +12,6 @@ Feature: Test the 'Digital age of consent verification' feature works.
|
||||
Scenario: User that is not considered a digital minor attempts to self-register on the site.
|
||||
# Try to access the sign up page.
|
||||
Given I am on homepage
|
||||
When I click on "Log in" "link" in the ".logininfo" "css_element"
|
||||
And I click on "Create new account" "link"
|
||||
Then I should see "Age and location verification"
|
||||
When I set the field "What is your age?" to "16"
|
||||
@@ -29,7 +28,6 @@ Feature: Test the 'Digital age of consent verification' feature works.
|
||||
Scenario: User that is considered a digital minor attempts to self-register on the site.
|
||||
# Try to access the sign up page.
|
||||
Given I am on homepage
|
||||
When I click on "Log in" "link" in the ".logininfo" "css_element"
|
||||
And I click on "Create new account" "link"
|
||||
Then I should see "Age and location verification"
|
||||
When I set the field "What is your age?" to "12"
|
||||
@@ -39,7 +37,6 @@ Feature: Test the 'Digital age of consent verification' feature works.
|
||||
And I should see "Please ask your parent/guardian to contact:"
|
||||
# Try to access the sign up page again.
|
||||
When I click on "Back to the site home" "link"
|
||||
And I click on "Log in" "link" in the ".logininfo" "css_element"
|
||||
And I click on "Create new account" "link"
|
||||
Then I should see "You are too young to create an account on this site."
|
||||
And I should see "Please ask your parent/guardian to contact:"
|
||||
|
||||
@@ -19,6 +19,8 @@ Feature: Course summary block used on the frontpage
|
||||
# The course summary block a default front page block, so no need to add it.
|
||||
|
||||
Scenario: Guest can view site summary
|
||||
Given the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
When I am on site homepage
|
||||
Then "Course/site summary" "block" should exist
|
||||
And I should not see "Course summary" in the "Course/site summary" "block"
|
||||
|
||||
@@ -8,6 +8,8 @@ Feature: Random glossary entry block can be added to the frontpage
|
||||
Given the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| glossary | Tips and Tricks | Frontpage glossary description | Acceptance test site | glossary0 |
|
||||
And the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Adding and configuring multiple Text blocks
|
||||
I need to be able to create, configure and change Text blocks
|
||||
|
||||
Background:
|
||||
Given I log in as "admin"
|
||||
Given the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
When I turn editing mode on
|
||||
And I add the "Text" block
|
||||
|
||||
@@ -11,6 +11,8 @@ Feature: Login from a block
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| login | System | 1 | site-index | side-pre |
|
||||
And the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
|
||||
Scenario: Login block visible to non-logged in users
|
||||
When I am on homepage
|
||||
|
||||
@@ -56,7 +56,10 @@ Feature: Expand the courses nodes within the navigation block
|
||||
|
||||
@javascript
|
||||
Scenario: As an anonymous user I expand the courses node to see courses.
|
||||
When I should see "You are not logged in." in the ".logininfo" "css_element"
|
||||
Given the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
When I am on site homepage
|
||||
Then I should see "You are not logged in." in the ".logininfo" "css_element"
|
||||
And I should see "Home" in the "Navigation" "block"
|
||||
And I should see "Courses" in the "Navigation" "block"
|
||||
And I expand "Courses" node
|
||||
|
||||
@@ -80,6 +80,8 @@ Feature: View my courses in navigation block
|
||||
Given the following config values are set as admin:
|
||||
| navshowmycoursecategories | 1 |
|
||||
| navshowallcourses | 1 |
|
||||
| forcelogin | 0 |
|
||||
When I am on homepage
|
||||
And I expand "Courses" node
|
||||
And I should see "cat1" in the "Navigation" "block"
|
||||
And I should see "cat2" in the "Navigation" "block"
|
||||
|
||||
@@ -28,6 +28,7 @@ Feature: Edit activities in Additional activities block
|
||||
Scenario: Activities in Additional activities block can be made available but not visible on a course page
|
||||
Given the following config values are set as admin:
|
||||
| allowstealth | 1 |
|
||||
| forcelogin | 0 |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| site_main_menu | System | 1 | site-index | side-pre |
|
||||
|
||||
@@ -21,6 +21,8 @@ Feature: Block tags displaying tag cloud
|
||||
| student1 | c1 | student |
|
||||
|
||||
Scenario: Add Tags block on a front page
|
||||
Given the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
|
||||
@@ -166,6 +166,7 @@ final class external_test extends \core_external\tests\externallib_testcase {
|
||||
global $CFG;
|
||||
|
||||
$CFG->bloglevel = BLOG_GLOBAL_LEVEL;
|
||||
$CFG->forcelogin = 0;
|
||||
|
||||
$result = \core_blog\external::get_entries();
|
||||
$result = external_api::clean_returnvalue(\core_blog\external::get_entries_returns(), $result);
|
||||
@@ -192,6 +193,9 @@ final class external_test extends \core_external\tests\externallib_testcase {
|
||||
* We don't get any because they are not public (restricted to real site users).
|
||||
*/
|
||||
public function test_get_not_public_entries_site_level_by_non_logged_users(): void {
|
||||
global $CFG;
|
||||
$CFG->forcelogin = 0;
|
||||
|
||||
$this->expectException('require_login_exception'); // In this case we get a security exception.
|
||||
$result = \core_blog\external::get_entries();
|
||||
}
|
||||
|
||||
@@ -286,13 +286,12 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$course = $courses['A1.1'];
|
||||
$category = \core_course_category::get($course->category);
|
||||
$wrongcategory = $categories['B1'];
|
||||
$generator->enrol_user($user->id, $course->id);
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
// Viewing the site as a whole.
|
||||
// Should see all courses that this user is enrolled in, and their
|
||||
// categories, and those categories parents.
|
||||
@@ -322,12 +321,12 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$course = $courses['A1.1'];
|
||||
$category = \core_course_category::get($course->category);
|
||||
$wrongcategory = $categories['B1'];
|
||||
$generator->enrol_user($user->id, $course->id);
|
||||
|
||||
$this->setUser($user);
|
||||
$time = time();
|
||||
|
||||
// Viewing the course calendar.
|
||||
@@ -371,12 +370,11 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$course = $courses['A1.1'];
|
||||
$category = \core_course_category::get($course->category);
|
||||
$generator->enrol_user($user->id, $course->id);
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
// Viewing the category calendar.
|
||||
// Should see all courses that this user is enrolled in within this
|
||||
// category, plus the site course, plus the category that course is
|
||||
@@ -412,12 +410,11 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$course = $courses['A1.1'];
|
||||
$category = \core_course_category::get($course->category);
|
||||
$generator->enrol_user($user->id, $course->id);
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
// Viewing the category calendar.
|
||||
// Should see all courses that this user is enrolled in within this
|
||||
// category, plus the site course, plus the category that course is
|
||||
@@ -456,12 +453,11 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$course = $courses['A1.1'];
|
||||
$category = $categories['A2'];
|
||||
$generator->enrol_user($user->id, $course->id);
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
// Viewing the category calendar.
|
||||
// Should see all courses that this user is enrolled in within this
|
||||
// category, plus the site course, plus the category that course is
|
||||
@@ -496,13 +492,12 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$course = $courses['A1.1'];
|
||||
$category = \core_course_category::get($course->category);
|
||||
$wrongcategory = $categories['B1'];
|
||||
$generator->enrol_user($user->id, $course->id);
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
// Viewing the category calendar for a category the user doesn't have any enrolments in.
|
||||
// Should see that category, and all categories underneath it.
|
||||
$calendar = \calendar_information::create(time(), SITEID, $wrongcategory->id);
|
||||
@@ -532,6 +527,7 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$coursea = $courses['A.1'];
|
||||
$courseb = $courses['A.2'];
|
||||
$category = \core_course_category::get($coursea->category);
|
||||
@@ -539,8 +535,6 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
$generator->enrol_user($user->id, $coursea->id);
|
||||
$generator->enrol_user($user->id, $courseb->id);
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
// Viewing the site azs a whole.
|
||||
// Should see all courses that this user is enrolled in.
|
||||
$calendar = \calendar_information::create(time(), SITEID, null);
|
||||
@@ -568,6 +562,7 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$coursea = $courses['A.1'];
|
||||
$courseb = $courses['A.2'];
|
||||
$category = \core_course_category::get($coursea->category);
|
||||
@@ -575,7 +570,6 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
$generator->enrol_user($user->id, $coursea->id);
|
||||
$generator->enrol_user($user->id, $courseb->id);
|
||||
|
||||
$this->setUser($user);
|
||||
$time = time();
|
||||
|
||||
// Viewing the course calendar.
|
||||
@@ -614,6 +608,7 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$coursea = $courses['A.1'];
|
||||
$courseb = $courses['A.2'];
|
||||
$category = \core_course_category::get($coursea->category);
|
||||
@@ -621,7 +616,6 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
$generator->enrol_user($user->id, $coursea->id);
|
||||
$generator->enrol_user($user->id, $courseb->id);
|
||||
|
||||
$this->setUser($user);
|
||||
$time = time();
|
||||
|
||||
// Viewing the other course calendar.
|
||||
@@ -661,6 +655,7 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$coursea = $courses['A.1'];
|
||||
$courseb = $courses['A.2'];
|
||||
$category = \core_course_category::get($coursea->category);
|
||||
@@ -668,8 +663,6 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
$generator->enrol_user($user->id, $coursea->id);
|
||||
$generator->enrol_user($user->id, $courseb->id);
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
// Viewing the category calendar.
|
||||
// Should see all courses that this user is enrolled in.
|
||||
$calendar = \calendar_information::create(time(), SITEID, $category->id);
|
||||
@@ -697,6 +690,7 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$coursea = $courses['A.1'];
|
||||
$courseb = $courses['A.2'];
|
||||
$category = \core_course_category::get($coursea->category);
|
||||
@@ -704,8 +698,6 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
$generator->enrol_user($user->id, $coursea->id);
|
||||
$generator->enrol_user($user->id, $courseb->id);
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
// Viewing the category calendar for a category the user doesn't have any enrolments in.
|
||||
// Should see that category, and all categories underneath it.
|
||||
$calendar = \calendar_information::create(time(), SITEID, $wrongcategory->id);
|
||||
@@ -731,6 +723,7 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$coursea = $courses['A.1'];
|
||||
$courseb = $courses['B.1'];
|
||||
$categorya = \core_course_category::get($coursea->category);
|
||||
@@ -739,8 +732,6 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
$generator->enrol_user($user->id, $coursea->id);
|
||||
$generator->enrol_user($user->id, $courseb->id);
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
// Viewing the site azs a whole.
|
||||
// Should see all courses that this user is enrolled in.
|
||||
$calendar = \calendar_information::create(time(), SITEID, null);
|
||||
@@ -768,6 +759,7 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$coursea = $courses['A.1'];
|
||||
$courseb = $courses['B.1'];
|
||||
$categorya = \core_course_category::get($coursea->category);
|
||||
@@ -776,7 +768,6 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
$generator->enrol_user($user->id, $coursea->id);
|
||||
$generator->enrol_user($user->id, $courseb->id);
|
||||
|
||||
$this->setUser($user);
|
||||
$time = time();
|
||||
|
||||
// Viewing the course calendar.
|
||||
@@ -815,6 +806,7 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$coursea = $courses['A.1'];
|
||||
$courseb = $courses['B.1'];
|
||||
$categorya = \core_course_category::get($coursea->category);
|
||||
@@ -823,7 +815,6 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
$generator->enrol_user($user->id, $coursea->id);
|
||||
$generator->enrol_user($user->id, $courseb->id);
|
||||
|
||||
$this->setUser($user);
|
||||
$time = time();
|
||||
|
||||
// Viewing the other course calendar.
|
||||
@@ -863,6 +854,7 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$coursea = $courses['A.1'];
|
||||
$courseb = $courses['B.1'];
|
||||
$categorya = \core_course_category::get($coursea->category);
|
||||
@@ -871,8 +863,6 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
$generator->enrol_user($user->id, $coursea->id);
|
||||
$generator->enrol_user($user->id, $courseb->id);
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
// Viewing the categorya calendar.
|
||||
// Should see all courses that this user is enrolled in.
|
||||
$calendar = \calendar_information::create(time(), SITEID, $categorya->id);
|
||||
@@ -904,6 +894,7 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$coursea = $courses['A.1'];
|
||||
$courseb = $courses['B.1'];
|
||||
$categorya = \core_course_category::get($coursea->category);
|
||||
@@ -912,7 +903,6 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
$generator->enrol_user($user->id, $coursea->id);
|
||||
$generator->enrol_user($user->id, $courseb->id);
|
||||
|
||||
$this->setUser($user);
|
||||
// Viewing the categorya calendar for a categorya the user doesn't have any enrolments in.
|
||||
// Should see that categorya, and all categories underneath it.
|
||||
$calendar = \calendar_information::create(time(), SITEID, $wrongcategory->id);
|
||||
@@ -961,12 +951,12 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
global $USER;
|
||||
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
list ($courses, $categories) = $this->mock_structure();
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$course = $courses['A1.1'];
|
||||
$category = \core_course_category::get($course->category);
|
||||
$this->setAdminUser();
|
||||
$generator->enrol_user($USER->id, $course->id);
|
||||
|
||||
$calendar = \calendar_information::create(time(), SITEID, null);
|
||||
@@ -992,13 +982,13 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
global $USER;
|
||||
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
list ($courses, $categories) = $this->mock_structure();
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$course = $courses['A1.1'];
|
||||
$category = \core_course_category::get($course->category);
|
||||
$wrongcategory = $categories['B1'];
|
||||
$this->setAdminUser();
|
||||
$generator->enrol_user($USER->id, $course->id);
|
||||
|
||||
$time = time();
|
||||
@@ -1039,13 +1029,13 @@ final class calendar_information_test extends \advanced_testcase {
|
||||
global $USER;
|
||||
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
list ($courses, $categories) = $this->mock_structure();
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$course = $courses['A1.1'];
|
||||
$category = \core_course_category::get($course->category);
|
||||
$wrongcategory = $categories['B1'];
|
||||
$this->setAdminUser();
|
||||
$generator->enrol_user($USER->id, $course->id);
|
||||
|
||||
$calendar = \calendar_information::create(time(), SITEID, $category->id);
|
||||
|
||||
@@ -105,10 +105,13 @@ final class provider_test extends provider_testcase {
|
||||
$user1 = $this->getDataGenerator()->create_user();
|
||||
$user2 = $this->getDataGenerator()->create_user();
|
||||
|
||||
// Set user context before creating comment objects,
|
||||
// as permission checks require an authenticated user.
|
||||
$this->setUser($user1);
|
||||
|
||||
$comment1 = $this->get_comment_object($coursecontext1, $course1);
|
||||
$comment2 = $this->get_comment_object($coursecontext2, $course2);
|
||||
|
||||
$this->setUser($user1);
|
||||
$comment1->add('First comment for user 1 on comment 1');
|
||||
$comment2->add('First comment for user 1 on comment 2');
|
||||
$this->setUser($user2);
|
||||
@@ -173,10 +176,13 @@ final class provider_test extends provider_testcase {
|
||||
$user1 = $this->getDataGenerator()->create_user();
|
||||
$user2 = $this->getDataGenerator()->create_user();
|
||||
|
||||
// Set user context before creating comment objects,
|
||||
// as permission checks require an authenticated user.
|
||||
$this->setUser($user1);
|
||||
|
||||
$comment1 = $this->get_comment_object($coursecontext1, $course1);
|
||||
$comment2 = $this->get_comment_object($coursecontext2, $course2);
|
||||
|
||||
$this->setUser($user1);
|
||||
$comment1->add('First comment for user 1 on comment 1');
|
||||
$comment2->add('First comment for user 1 on comment 2');
|
||||
$this->setUser($user2);
|
||||
@@ -245,11 +251,14 @@ final class provider_test extends provider_testcase {
|
||||
$user1 = $this->getDataGenerator()->create_user();
|
||||
$user2 = $this->getDataGenerator()->create_user();
|
||||
|
||||
// Set user context before creating comment objects,
|
||||
// as permission checks require an authenticated user.
|
||||
$this->setUser($user1);
|
||||
|
||||
$comment1 = $this->get_comment_object($coursecontext1, $course1);
|
||||
$comment2 = $this->get_comment_object($coursecontext2, $course2);
|
||||
$comment3 = $this->get_comment_object($coursecontext3, $course3);
|
||||
|
||||
$this->setUser($user1);
|
||||
$comment1->add('First comment for user 1');
|
||||
$comment2->add('User 1 comment in second comment');
|
||||
|
||||
@@ -329,11 +338,14 @@ final class provider_test extends provider_testcase {
|
||||
$user2 = $this->getDataGenerator()->create_user();
|
||||
$user3 = $this->getDataGenerator()->create_user();
|
||||
|
||||
// Set user context before creating comment objects,
|
||||
// as permission checks require an authenticated user.
|
||||
$this->setUser($user1);
|
||||
|
||||
$comment1 = $this->get_comment_object($coursecontext1, $course1);
|
||||
$comment2 = $this->get_comment_object($coursecontext2, $course2);
|
||||
$comment3 = $this->get_comment_object($coursecontext3, $course3);
|
||||
|
||||
$this->setUser($user1);
|
||||
$comment1->add('First comment for user 1');
|
||||
$comment2->add('User 1 comment in second comment');
|
||||
|
||||
|
||||
@@ -380,6 +380,7 @@ final class stateupdates_test extends \advanced_testcase {
|
||||
public function test_put_section_state_extra_updates(): void {
|
||||
global $DB, $CFG;
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
require_once($CFG->libdir . '/tests/fixtures/sectiondelegatetest.php');
|
||||
|
||||
|
||||
@@ -2890,6 +2890,7 @@ final class courselib_test extends advanced_testcase {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$category = $generator->create_category();
|
||||
|
||||
@@ -673,12 +673,12 @@ final class management_helper_test extends \advanced_testcase {
|
||||
'shortname' => 'Advanced algebra', 'idnumber' => '10002'));
|
||||
$syscontext = \context_system::instance();
|
||||
|
||||
// Update category object from DB so the course count is correct.
|
||||
$category = core_course_category::get($category->id);
|
||||
|
||||
list($user, $roleid) = $this->get_user_objects($generator, $syscontext->id);
|
||||
$caps = course_capability_assignment::allow(self::CATEGORY_MANAGE, $roleid, $syscontext->id);
|
||||
|
||||
// Update category object from DB so the course count is correct.
|
||||
$category = core_course_category::get($category->id);
|
||||
|
||||
// Check that sort order in the DB matches what we've got in the cache.
|
||||
$courses = $category->get_courses();
|
||||
$this->assertIsArray($courses);
|
||||
@@ -994,12 +994,12 @@ final class management_helper_test extends \advanced_testcase {
|
||||
$course1 = $generator->create_course(array('category' => $category->id));
|
||||
$context = $category->get_context();
|
||||
|
||||
// Update category object from DB so the course count is correct.
|
||||
$category = core_course_category::get($category->id);
|
||||
|
||||
list($user, $roleid) = $this->get_user_objects($generator, $context->id);
|
||||
$caps = course_capability_assignment::allow(self::CATEGORY_MANAGE, $roleid, $context->id);
|
||||
|
||||
// Update category object from DB so the course count is correct.
|
||||
$category = core_course_category::get($category->id);
|
||||
|
||||
$courses = $category->get_courses();
|
||||
$this->assertIsArray($courses);
|
||||
$this->assertEquals(array($course1->id, $course2->id, $course3->id), array_keys($courses));
|
||||
|
||||
@@ -24,6 +24,8 @@ Feature: Default value for the textarea custom field can contain images
|
||||
And the following "user private files" exist:
|
||||
| user | filepath |
|
||||
| admin | lib/tests/fixtures/gd-logo.png |
|
||||
And the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
And I log in as "admin"
|
||||
And I navigate to "Courses > Default settings > Course custom fields" in site administration
|
||||
And I click on "Add a new custom field" "link"
|
||||
|
||||
@@ -44,6 +44,7 @@ final class sync_members_test extends \lti_advantage_testcase {
|
||||
protected function verify_user_profile_image(int $userid, bool $match = true): void {
|
||||
global $CFG;
|
||||
$user = \core_user::get_user($userid);
|
||||
$this->setUser($user);
|
||||
$usercontext = \context_user::instance($user->id);
|
||||
$expected = $CFG->wwwroot . '/pluginfile.php/' . $usercontext->id . '/user/icon/boost/f2?rev='. $user->picture;
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace filter_activitynames;
|
||||
final class text_filter_test extends \advanced_testcase {
|
||||
public function test_links(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
// Create a test course.
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
@@ -161,6 +162,7 @@ final class text_filter_test extends \advanced_testcase {
|
||||
*/
|
||||
public function test_links_with_whitespace(string $activityname, string $html, bool $expectedresult): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$context = \context_course::instance($course->id);
|
||||
@@ -178,6 +180,7 @@ final class text_filter_test extends \advanced_testcase {
|
||||
|
||||
public function test_cache(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
// Create a test courses.
|
||||
$course1 = $this->getDataGenerator()->create_course();
|
||||
|
||||
@@ -29,6 +29,7 @@ final class text_filter_test extends \advanced_testcase {
|
||||
public function test_link_to_entry_with_alias(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
// Enable glossary filter at top level.
|
||||
filter_set_global_state('glossary', TEXTFILTER_ON);
|
||||
@@ -75,6 +76,7 @@ final class text_filter_test extends \advanced_testcase {
|
||||
public function test_longest_link_used(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
// Enable glossary filter at top level.
|
||||
filter_set_global_state('glossary', TEXTFILTER_ON);
|
||||
@@ -114,6 +116,7 @@ final class text_filter_test extends \advanced_testcase {
|
||||
public function test_link_to_category(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
// Enable glossary filter at top level.
|
||||
filter_set_global_state('glossary', TEXTFILTER_ON);
|
||||
@@ -154,6 +157,7 @@ final class text_filter_test extends \advanced_testcase {
|
||||
public function test_ampersands(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
// Enable glossary filter at top level.
|
||||
filter_set_global_state('glossary', TEXTFILTER_ON);
|
||||
@@ -202,6 +206,7 @@ final class text_filter_test extends \advanced_testcase {
|
||||
public function test_brackets(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
// Enable glossary filter at top level.
|
||||
filter_set_global_state('glossary', TEXTFILTER_ON);
|
||||
@@ -248,6 +253,7 @@ final class text_filter_test extends \advanced_testcase {
|
||||
global $CFG, $GLOSSARY_EXCLUDEENTRY;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
// Enable glossary filter at top level.
|
||||
filter_set_global_state('glossary', TEXTFILTER_ON);
|
||||
@@ -292,6 +298,7 @@ final class text_filter_test extends \advanced_testcase {
|
||||
public function test_exclude_does_not_exclude_categories(): void {
|
||||
global $CFG, $GLOSSARY_EXCLUDEENTRY;
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
// Enable glossary filter at top level.
|
||||
filter_set_global_state('glossary', TEXTFILTER_ON);
|
||||
|
||||
@@ -125,6 +125,7 @@ final class testing_generator_test extends \advanced_testcase {
|
||||
|
||||
// Test generating user with interests.
|
||||
$user = $generator->create_user(array('interests' => 'Cats, Dogs'));
|
||||
$this->setUser($user);
|
||||
$userdetails = user_get_user_details($user);
|
||||
$this->assertSame('Cats, Dogs', $userdetails['interests']);
|
||||
}
|
||||
|
||||
@@ -3698,7 +3698,7 @@ final class accesslib_test extends advanced_testcase {
|
||||
|
||||
$this->assertFalse(has_capability('moodle/block:view', $frontpageblockcontext, 0));
|
||||
$this->assertFalse(has_capability('mod/page:view', $frontpagepagecontext, 0));
|
||||
$this->assertTrue(has_capability('mod/page:view', $frontpagecontext, 0));
|
||||
$this->assertFalse(has_capability('mod/page:view', $frontpagecontext, 0));
|
||||
$this->assertFalse(has_capability('mod/page:view', $systemcontext, 0));
|
||||
|
||||
$this->assertFalse(has_capability('moodle/course:create', $systemcontext, $testusers[11]));
|
||||
|
||||
@@ -109,6 +109,7 @@ final class analysers_test extends \advanced_testcase {
|
||||
*/
|
||||
public function test_site_courses_analyser(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
$course1 = $this->getDataGenerator()->create_course();
|
||||
$course2 = $this->getDataGenerator()->create_course();
|
||||
|
||||
@@ -30,6 +30,8 @@ Feature: Profile picture access
|
||||
And the following "role capability" exists:
|
||||
| role | dangerous |
|
||||
| moodle/user:viewprofilepictures | prohibit |
|
||||
And the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
And I am on the "Profile editing" page logged in as "student1"
|
||||
And I upload "/course/tests/fixtures/image.jpg" file to "New picture" filemanager
|
||||
And I set the field "Picture description" to "MyPic"
|
||||
|
||||
@@ -312,6 +312,7 @@ final class datalib_test extends \advanced_testcase {
|
||||
*/
|
||||
public function test_get_courses_with_fields(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$category = $this->getDataGenerator()->create_category();
|
||||
$course = $this->getDataGenerator()->create_course(['category' => $category->id]);
|
||||
@@ -707,6 +708,7 @@ final class datalib_test extends \advanced_testcase {
|
||||
public function test_max_courses_in_category(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
// Default settings.
|
||||
$this->assertEquals(MAX_COURSES_IN_CATEGORY, get_max_courses_in_category());
|
||||
|
||||
@@ -63,6 +63,9 @@ final class events_test extends \advanced_testcase {
|
||||
* Test the course category updated event.
|
||||
*/
|
||||
public function test_course_category_updated(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
// Create a category.
|
||||
$category = $this->getDataGenerator()->create_category();
|
||||
|
||||
|
||||
@@ -493,6 +493,7 @@ final class formatting_test extends \advanced_testcase {
|
||||
public function test_format_text_nolink(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
$formatter = new formatting();
|
||||
|
||||
filter_set_global_state('activitynames', TEXTFILTER_ON);
|
||||
|
||||
@@ -50,6 +50,8 @@ final class user_picture_test extends \advanced_testcase {
|
||||
$adminid = $DB->get_field('user', 'id', ['username' => 'admin'], MUST_EXIST);
|
||||
|
||||
// Default config allows user pictures when not logged in.
|
||||
// Force login is now enabled by default: MDL-87523.
|
||||
set_config('forcelogin', 0);
|
||||
$this->assertTrue(user_picture::allow_view($adminid));
|
||||
|
||||
// Not allowed with either or both forcelogin options.
|
||||
|
||||
@@ -133,6 +133,7 @@ final class outputcomponents_test extends \advanced_testcase {
|
||||
global $DB, $CFG, $USER;
|
||||
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
// Verify new install contains expected defaults.
|
||||
$this->assertSame(theme_config::DEFAULT_THEME, $CFG->theme);
|
||||
|
||||
@@ -937,6 +937,7 @@ final class user_test extends \advanced_testcase {
|
||||
public function test_display_profile_picture(): void {
|
||||
global $OUTPUT, $CFG;
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$user1 = $this->getDataGenerator()->create_user(['firstname' => 'John', 'lastname' => 'Doe']);
|
||||
$user2 = $this->getDataGenerator()->create_user(['picture' => 1]);
|
||||
|
||||
@@ -97,6 +97,7 @@ final class weblib_format_text_test extends \advanced_testcase {
|
||||
public function test_format_text_nolink(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
filter_set_global_state('activitynames', TEXTFILTER_ON);
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
|
||||
@@ -22,7 +22,7 @@ Feature: Change password
|
||||
And I click on "Continue" "button"
|
||||
And I should see "Preferences" in the "region-main" "region"
|
||||
And I log out
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
And I set the field "Username" to "testuser"
|
||||
And I set the field "Password" to "NewPassword1*"
|
||||
And I press "Log in"
|
||||
@@ -49,7 +49,7 @@ Feature: Change password
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| testuser | c1 | student |
|
||||
When I follow "Log in"
|
||||
When I am on homepage
|
||||
And I set the field "Username" to "testuser"
|
||||
And I set the field "Password" to "testuser"
|
||||
And I press "Log in"
|
||||
|
||||
@@ -12,7 +12,7 @@ Feature: Login using email address
|
||||
Scenario Outline: A user can login using their email address
|
||||
Given the following config values are set as admin:
|
||||
| authloginviaemail | <authloginviaemail> |
|
||||
When I follow "Log in"
|
||||
When I am on homepage
|
||||
And I set the field "Username" to "<login>"
|
||||
And I set the field "Password" to "test"
|
||||
And I press "Log in"
|
||||
|
||||
@@ -5300,6 +5300,7 @@ final class api_test extends \advanced_testcase {
|
||||
*/
|
||||
public function test_get_conversation_members(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$lastaccess = new \stdClass();
|
||||
$lastaccess->lastaccess = time();
|
||||
@@ -5373,6 +5374,7 @@ final class api_test extends \advanced_testcase {
|
||||
*/
|
||||
public function test_get_conversation_members_with_contact_requests(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$lastaccess = new \stdClass();
|
||||
$lastaccess->lastaccess = time();
|
||||
@@ -5471,6 +5473,7 @@ final class api_test extends \advanced_testcase {
|
||||
$lastaccess->lastaccess = time();
|
||||
|
||||
$user1 = self::getDataGenerator()->create_user($lastaccess);
|
||||
$this->setUser($user1);
|
||||
|
||||
$selfconversation = api::get_self_conversation($user1->id);
|
||||
testhelper::send_fake_message_to_conversation($user1, $selfconversation->id, 'This is a self-message!');
|
||||
|
||||
@@ -39,7 +39,10 @@ Feature: Anonymous feedback
|
||||
And I log out
|
||||
|
||||
Scenario: Guests can see anonymous feedback on front page but can not complete
|
||||
When I follow "Site feedback"
|
||||
Given the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
When I am on site homepage
|
||||
And I follow "Site feedback"
|
||||
Then I should not see "Answer the questions"
|
||||
And I should not see "Preview questions"
|
||||
|
||||
@@ -102,8 +105,10 @@ Feature: Anonymous feedback
|
||||
Scenario: Complete fully anonymous feedback on the front page as a guest
|
||||
Given the following config values are set as admin:
|
||||
| feedback_allowfullanonymous | 1 |
|
||||
When I follow "Site feedback"
|
||||
And I should not see "Preview questions"
|
||||
| forcelogin | 0 |
|
||||
When I am on site homepage
|
||||
And I follow "Site feedback"
|
||||
Then I should not see "Preview questions"
|
||||
And I follow "Answer the questions"
|
||||
And I should see "Do you like our site?"
|
||||
And I set the following fields to these values:
|
||||
@@ -116,11 +121,13 @@ Feature: Anonymous feedback
|
||||
Scenario: Complete fully anonymous feedback and view analyze on the front page as a guest
|
||||
Given the following config values are set as admin:
|
||||
| feedback_allowfullanonymous | 1 |
|
||||
| forcelogin | 0 |
|
||||
And the following "role capability" exists:
|
||||
| role | guest |
|
||||
| mod/feedback:viewanalysepage | allow |
|
||||
When I follow "Site feedback"
|
||||
And I should not see "Preview questions"
|
||||
When I am on site homepage
|
||||
And I follow "Site feedback"
|
||||
Then I should not see "Preview questions"
|
||||
And I follow "Answer the questions"
|
||||
And I should see "Do you like our site?"
|
||||
And I set the following fields to these values:
|
||||
|
||||
@@ -224,6 +224,8 @@ Feature: A user can control their own subscription preferences for a discussion
|
||||
And the following "mod_forum > discussions" exist:
|
||||
| user | forum | name | message |
|
||||
| admin | forum1 | Test post subject one | Test post message one |
|
||||
And the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
When I am on site homepage
|
||||
And I follow "Test forum name"
|
||||
Then "Subscribe to this discussion" "checkbox" should not exist in the "Test post subject one" "table_row"
|
||||
|
||||
@@ -2068,6 +2068,7 @@ final class lib_test extends \advanced_testcase {
|
||||
}
|
||||
|
||||
public function test_discussion_pinned_sort(): void {
|
||||
$this->setAdminUser();
|
||||
list($forum, $discussionids) = $this->create_multiple_discussions_with_replies(10, 5);
|
||||
$cm = get_coursemodule_from_instance('forum', $forum->id);
|
||||
$discussions = forum_get_discussions($cm);
|
||||
|
||||
@@ -66,6 +66,7 @@ final class send_user_notifications_test extends \advanced_testcase {
|
||||
require_once($CFG->dirroot . '/mod/forum/lib.php');
|
||||
$CFG->handlebounces = true;
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
$this->preventResetByRollback();
|
||||
$this->redirectEmails();
|
||||
|
||||
|
||||
@@ -46,6 +46,10 @@ final class browser_test extends \advanced_testcase {
|
||||
$coursecategory = $this->getDataGenerator()->create_category(['name' => 'Category']);
|
||||
$coursecatcontext = \context_coursecat::instance($coursecategory->id);
|
||||
|
||||
$admin = get_admin();
|
||||
// Log in as admin.
|
||||
$this->setUser($admin);
|
||||
|
||||
// Get the default course category.
|
||||
$defaultcat = \core_course_category::get(1);
|
||||
$defaultcatcontext = \context_coursecat::instance($defaultcat->id);
|
||||
@@ -53,10 +57,6 @@ final class browser_test extends \advanced_testcase {
|
||||
// Create course.
|
||||
$course = $this->getDataGenerator()->create_course(['category' => $coursecategory->id]);
|
||||
|
||||
$admin = get_admin();
|
||||
// Create a user (not enrolled in a course).
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
|
||||
// Add some content to the content bank.
|
||||
$generator = $this->getDataGenerator()->get_plugin_generator('core_contentbank');
|
||||
// Add some content bank files in the system context.
|
||||
@@ -64,8 +64,6 @@ final class browser_test extends \advanced_testcase {
|
||||
$contentbankcontents = $generator->generate_contentbank_data('contenttype_h5p', 3, $admin->id,
|
||||
$systemcontext, true, $filepath);
|
||||
|
||||
// Log in as admin.
|
||||
$this->setUser($admin);
|
||||
// Get the content bank nodes displayed to the admin in the system context.
|
||||
$browser = new \repository_contentbank\browser\contentbank_browser_context_system($systemcontext);
|
||||
$repositorycontentnodes = $browser->get_content();
|
||||
@@ -86,6 +84,8 @@ final class browser_test extends \advanced_testcase {
|
||||
$expected = $this->generate_expected_content($contextfolders, $contentbankcontents);
|
||||
$this->assertEqualsCanonicalizing($expected, $repositorycontentnodes);
|
||||
|
||||
// Create a user (not enrolled in a course).
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
// Log in as a user.
|
||||
$this->setUser($user);
|
||||
// Get the content bank nodes displayed to an authenticated user in the system context.
|
||||
|
||||
@@ -44,6 +44,7 @@ final class repositorylib_test extends \advanced_testcase {
|
||||
global $CFG, $DB;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
$syscontext = \context_system::instance();
|
||||
$repositorypluginname = 'dropbox';
|
||||
|
||||
@@ -31,7 +31,9 @@ Feature: Language selector menu
|
||||
And "English (pirate) (en_ar)" "link" should exist in the "Language selector" user submenu
|
||||
|
||||
Scenario: Non-logged user is presented with a language selector which is placed within the navbar
|
||||
Given I am on site homepage
|
||||
Given the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
When I am on site homepage
|
||||
# The language selector menu is present in the navbar when a user is not logged in.
|
||||
And language selector menu should exist in the navbar
|
||||
And "English (en)" "link" should exist in the language selector menu
|
||||
@@ -64,13 +66,15 @@ Feature: Language selector menu
|
||||
And "Language" "link" should not exist in the user menu
|
||||
|
||||
Scenario: Non-logged user is not presented with a language selector if there is less than two installed languages
|
||||
Given I log in as "admin"
|
||||
Given the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
When I log in as "admin"
|
||||
And I navigate to "Language > Language packs" in site administration
|
||||
And I set the field "Installed language packs" to "en_ar"
|
||||
And I press "Uninstall selected language pack(s)"
|
||||
And I click on "Yes" "button" in the "Uninstall selected language pack(s)" "dialogue"
|
||||
And the "Installed language packs" select box should not contain "en_ar"
|
||||
And I log out
|
||||
When I am on site homepage
|
||||
When I am on homepage
|
||||
# The language selector menu is not present in the navbar.
|
||||
Then language selector menu should not exist in the navbar
|
||||
|
||||
@@ -32,6 +32,8 @@ Feature: Contact site support method and availability can be customised
|
||||
Scenario: Contact site support can be limited to authenticated users
|
||||
Given the following config values are set as admin:
|
||||
| supportavailability | 1 |
|
||||
And the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
# Confirm unauthenticated visitor cannot see the option or directly access the page.
|
||||
When I am on site homepage
|
||||
Then I should not see "Contact site support" in the "page-footer" "region"
|
||||
|
||||
@@ -30,8 +30,7 @@ Feature: Custom profile fields should be visible and editable by those with the
|
||||
|
||||
@javascript
|
||||
Scenario: Visible custom profile fields can be part of the sign up form for anonymous users.
|
||||
Given I am on site homepage
|
||||
And I follow "Log in"
|
||||
Given I am on homepage
|
||||
When I click on "Create new account" "link"
|
||||
And I expand all fieldsets
|
||||
Then I should not see "notvisible_field"
|
||||
|
||||
@@ -8,8 +8,7 @@ Feature: Both first name and last name are always available for every user
|
||||
Given the following config values are set as admin:
|
||||
| registerauth | email |
|
||||
| passwordpolicy | 0 |
|
||||
And I am on site homepage
|
||||
And I follow "Log in"
|
||||
And I am on homepage
|
||||
And I click on "Create new account" "link"
|
||||
When I set the following fields to these values:
|
||||
| Username | mrwhitespace |
|
||||
|
||||
@@ -37,6 +37,7 @@ final class userlib_test extends \advanced_testcase {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
// Create user and modify user profile.
|
||||
$user1 = $this->getDataGenerator()->create_user();
|
||||
@@ -937,6 +938,7 @@ final class userlib_test extends \advanced_testcase {
|
||||
global $CFG;
|
||||
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
// Create user and modify user profile.
|
||||
$teacher = $this->getDataGenerator()->create_user();
|
||||
|
||||
Reference in New Issue
Block a user