mirrored from git://git.moodle.org/moodle.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-69772 admin: Better validation for the allcountrycodes setting
The patch introduces a new admin_setting fiela type that can be used for specifying comma separated list of countries. The field has inbuilt validation so that only valid country codes can be inserted.
- Loading branch information
Showing
4 changed files
with
92 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@core @core_admin | ||
Feature: Administrator is warned and when trying to set invalid allcountrycodes value. | ||
In order to avoid misconfiguration of the country selector fields | ||
As an admin | ||
I want to be warned when I try to set an invalid country code in the allcountrycodes field | ||
|
||
Scenario: Attempting to set allcountrycodes field with valid country codes | ||
Given I log in as "admin" | ||
And I navigate to "Location > Location settings" in site administration | ||
When I set the following administration settings values: | ||
| All country codes | CZ,BE,GB,ES | | ||
Then I should not see "Invalid country code" | ||
|
||
Scenario: Attempting to set allcountrycodes field with invalid country code | ||
Given I log in as "admin" | ||
And I navigate to "Location > Location settings" in site administration | ||
When I set the following administration settings values: | ||
| All country codes | CZ,BE,FOOBAR,GB,ES | | ||
Then I should see "Invalid country code: FOOBAR" | ||
|
||
Scenario: Attempting to unset allcountrycodes field | ||
Given I log in as "admin" | ||
And I navigate to "Location > Location settings" in site administration | ||
And I set the following administration settings values: | ||
| All country codes | CZ,BE,GB,ES | | ||
And I navigate to "Location > Location settings" in site administration | ||
When I set the following administration settings values: | ||
| All country codes | | | ||
Then I should not see "Invalid country code" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters