mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'MDL-75788-master' of https://github.com/lameze/moodle
This commit is contained in:
commit
ff871829c5
5 changed files with 44 additions and 17 deletions
|
@ -66,14 +66,10 @@ Feature: Upload users
|
||||||
@javascript
|
@javascript
|
||||||
Scenario: Upload users with custom profile fields
|
Scenario: Upload users with custom profile fields
|
||||||
# Create user profile field.
|
# Create user profile field.
|
||||||
Given I log in as "admin"
|
Given the following "custom profile fields" exist:
|
||||||
And I navigate to "Users > Accounts > User profile fields" in site administration
|
| datatype | shortname | name |
|
||||||
And I click on "Create a new profile field" "link"
|
| text | superfield | Super field |
|
||||||
And I click on "Text area" "link"
|
And I log in as "admin"
|
||||||
And I set the following fields to these values:
|
|
||||||
| Short name | superfield |
|
|
||||||
| Name | Super field |
|
|
||||||
And I click on "Save changes" "button"
|
|
||||||
# Upload users.
|
# Upload users.
|
||||||
When I navigate to "Users > Accounts > Upload users" in site administration
|
When I navigate to "Users > Accounts > Upload users" in site administration
|
||||||
And I upload "lib/tests/fixtures/upload_users_profile.csv" file to "File" filemanager
|
And I upload "lib/tests/fixtures/upload_users_profile.csv" file to "File" filemanager
|
||||||
|
|
|
@ -62,15 +62,10 @@ Feature: availability_profile
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
Scenario: Test with custom user profile field
|
Scenario: Test with custom user profile field
|
||||||
# Add custom field.
|
Given the following "custom profile fields" exist:
|
||||||
Given I log in as "admin"
|
| datatype | shortname | name |
|
||||||
And I navigate to "Users > Accounts > User profile fields" in site administration
|
| text | superfield | Super field |
|
||||||
And I click on "Create a new profile field" "link"
|
And I log in as "admin"
|
||||||
And I click on "Text input" "link"
|
|
||||||
And I set the following fields to these values:
|
|
||||||
| Short name | superfield |
|
|
||||||
| Name | Super field |
|
|
||||||
And I click on "Save changes" "button"
|
|
||||||
|
|
||||||
# Set field value for user.
|
# Set field value for user.
|
||||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||||
|
|
|
@ -1324,6 +1324,11 @@ EOD;
|
||||||
[$data['categoryid']]) + 1;
|
[$data['categoryid']]) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($data['datatype'] === 'menu' && isset($data['param1'])) {
|
||||||
|
// Convert new lines to the proper character.
|
||||||
|
$data['param1'] = str_replace('\n', "\n", $data['param1']);
|
||||||
|
}
|
||||||
|
|
||||||
// Defaults for other values.
|
// Defaults for other values.
|
||||||
$defaults = [
|
$defaults = [
|
||||||
'description' => '',
|
'description' => '',
|
||||||
|
|
|
@ -577,5 +577,12 @@ class testing_generator_test extends \advanced_testcase {
|
||||||
$field7 = $generator->create_custom_profile_field(
|
$field7 = $generator->create_custom_profile_field(
|
||||||
['datatype' => 'checkbox', 'shortname' => 'areyousure', 'name' => 'Are you sure?']);
|
['datatype' => 'checkbox', 'shortname' => 'areyousure', 'name' => 'Are you sure?']);
|
||||||
$this->assertEquals(0, $field7->defaultdata);
|
$this->assertEquals(0, $field7->defaultdata);
|
||||||
|
|
||||||
|
// Check setting options for menu using \n work as expected.
|
||||||
|
$field8 = $generator->create_custom_profile_field([
|
||||||
|
'datatype' => 'menu', 'shortname' => 'cuisine', 'name' => 'Cuisine', 'param1' => 'French\nChinese\nLebanese',
|
||||||
|
'defaultdata' => 'Chinese'
|
||||||
|
]);
|
||||||
|
$this->assertEquals("French\nChinese\nLebanese", $field8->param1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -279,3 +279,27 @@ Feature: Custom profile fields should be visible and editable by those with the
|
||||||
| everyonevisible_field | everyonevisible_field_information |
|
| everyonevisible_field | everyonevisible_field_information |
|
||||||
| uservisible_field | uservisible_field_information |
|
| uservisible_field | uservisible_field_information |
|
||||||
| teachervisible_field | teachervisible_field_information |
|
| teachervisible_field | teachervisible_field_information |
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: Menu profile field's default data works as expected when editing user profile
|
||||||
|
Given the following "custom profile fields" exist:
|
||||||
|
| datatype | shortname | name | visible | param1 | defaultdata |
|
||||||
|
| menu | menufield | Menu field | 2 | OptA\nOptB\nOptC | OptB |
|
||||||
|
And I log in as "userwithinformation"
|
||||||
|
When I follow "Profile" in the user menu
|
||||||
|
And I click on "Edit profile" "link" in the "region-main" "region"
|
||||||
|
Then the following fields match these values:
|
||||||
|
| Menu field | OptB |
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: Menu profile field successfully updated when editing user profile
|
||||||
|
Given the following "custom profile fields" exist:
|
||||||
|
| datatype | shortname | name | visible | param1 |
|
||||||
|
| menu | menufield | Menu field | 2 | OptA\nOptB\nOptC |
|
||||||
|
And I log in as "userwithinformation"
|
||||||
|
When I follow "Profile" in the user menu
|
||||||
|
And I click on "Edit profile" "link" in the "region-main" "region"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Menu field | OptC |
|
||||||
|
And I click on "Update profile" "button"
|
||||||
|
Then I should see "OptC"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue