Merge branch 'MDL-52708' of https://github.com/ramdesh/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Mon, 9 May 2016 07:49:48 +0000 (15:49 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Mon, 9 May 2016 07:49:48 +0000 (15:49 +0800)
admin/tests/behat/enable_multiple_accounts_use_same_email.feature [new file with mode: 0644]

diff --git a/admin/tests/behat/enable_multiple_accounts_use_same_email.feature b/admin/tests/behat/enable_multiple_accounts_use_same_email.feature
new file mode 100644 (file)
index 0000000..30d21b9
--- /dev/null
@@ -0,0 +1,57 @@
+@core @core_admin
+Feature: Enable multiple accounts to have the same email address
+  In order to have multiple accounts registerd on the system with the same email address
+  As an admin
+  I need to enable multiple accounts to be registered with the same email address and verify it is applied
+
+  Background:
+    Given I log in as "admin"
+
+  Scenario: Enable registration of multiple accounts with the same email address
+    Given the following config values are set as admin:
+      | allowaccountssameemail | 1 |
+    When I navigate to "Add a new user" node in "Site administration>Users>Accounts"
+    And I set the following fields to these values:
+      | Username                        | testmultiemailuser1             |
+      | Choose an authentication method | Manual accounts                 |
+      | New password                    | test@User1                      |
+      | First name                      | Test                            |
+      | Surname                         | Multi1                          |
+      | Email address                   | testmultiemailuser@example.com  |
+    And I press "Create user"
+    And I should see "Test Multi1"
+    And I press "Add a new user"
+    And I set the following fields to these values:
+      | Username                        | testmultiemailuser2             |
+      | Choose an authentication method | Manual accounts                 |
+      | New password                    | test@User2                      |
+      | First name                      | Test                            |
+      | Surname                         | Multi2                          |
+      | Email address                   | testmultiemailuser@example.com  |
+    And I press "Create user"
+    Then I should see "Test Multi2"
+    And I should not see "This email address is already registered"
+
+  Scenario: Disable registration of multiple accounts with the same email address
+    Given the following config values are set as admin:
+      | allowaccountssameemail | 0 |
+    When I navigate to "Add a new user" node in "Site administration>Users>Accounts"
+    And I set the following fields to these values:
+      | Username                        | testmultiemailuser1             |
+      | Choose an authentication method | Manual accounts                 |
+      | New password                    | test@User1                      |
+      | First name                      | Test                            |
+      | Surname                         | Multi1                          |
+      | Email address                   | testmultiemailuser@example.com  |
+    And I press "Create user"
+    And I should see "Test Multi1"
+    And I press "Add a new user"
+    And I set the following fields to these values:
+      | Username                        | testmultiemailuser2             |
+      | Choose an authentication method | Manual accounts                 |
+      | New password                    | test@User2                      |
+      | First name                      | Test                            |
+      | Surname                         | Multi2                          |
+      | Email address                   | testmultiemailuser@example.com  |
+    And I press "Create user"
+    Then I should see "This email address is already registered"
\ No newline at end of file