MDL-52335 tool_uploaduser: php7 compatibility in variable syntax
This commit is contained in:
@@ -232,8 +232,8 @@ if ($formdata = $mform2->is_cancelled()) {
|
||||
if (isset($USER->$key) and is_array($USER->$key)) {
|
||||
// this must be some hacky field that is abusing arrays to store content and format
|
||||
$user->$key = array();
|
||||
$user->$key['text'] = $value;
|
||||
$user->$key['format'] = FORMAT_MOODLE;
|
||||
$user->{$key['text']} = $value;
|
||||
$user->{$key['format']} = FORMAT_MOODLE;
|
||||
} else {
|
||||
$user->$key = trim($value);
|
||||
}
|
||||
|
||||
+23
-1
@@ -1,4 +1,4 @@
|
||||
@core @core_admin @_file_upload
|
||||
@tool @tool_uploaduser @_file_upload
|
||||
Feature: Upload users
|
||||
In order to add users to the system
|
||||
As an admin
|
||||
@@ -39,3 +39,25 @@ Feature: Upload users
|
||||
And I follow "Groups"
|
||||
And I set the field "groups" to "Section 1 (1)"
|
||||
And the "members" select box should contain "Tom Jones"
|
||||
|
||||
@javascript
|
||||
Scenario: Upload users with custom profile fields
|
||||
# Create user profile field.
|
||||
Given I log in as "admin"
|
||||
And I navigate to "User profile fields" node in "Site administration > Users > Accounts"
|
||||
And I set the field "datatype" to "Text area"
|
||||
And I set the following fields to these values:
|
||||
| Short name | superfield |
|
||||
| Name | Super field |
|
||||
And I click on "Save changes" "button"
|
||||
# Upload users.
|
||||
When I navigate to "Upload users" node in "Site administration > Users > Accounts"
|
||||
And I upload "lib/tests/fixtures/upload_users_profile.csv" file to "File" filemanager
|
||||
And I press "Upload users"
|
||||
And I press "Upload users"
|
||||
# Check that users were created and the superfield is filled.
|
||||
And I navigate to "Browse list of users" node in "Site administration > Users > Accounts"
|
||||
And I follow "Tom Jones"
|
||||
And I should see "Super field"
|
||||
And I should see "The big guy"
|
||||
And I log out
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
username,password,firstname,lastname,email,profile_field_superfield
|
||||
jonest,verysecret,Tom,Jones,[email protected],The big guy
|
||||
reznort,somesecret,Trent,Reznor,[email protected],Loves cats
|
||||
|
Reference in New Issue
Block a user