], [
'type' => 'invalidpreference',
'value' => 'abcd'
- ]]
- );
+ ]
+ ],
+ 'department' => 'College of Science',
+ 'institution' => 'National Institute of Physics',
+ 'phone1' => '01 2345 6789',
+ 'maildisplay' => 1,
+ 'interests' => 'badminton, basketball, cooking, '
+ );
$context = context_system::instance();
$roleid = $this->assignUserCapability('moodle/user:create', $context->id);
$this->assertEquals($dbuser->description, $user1['description']);
$this->assertEquals($dbuser->city, $user1['city']);
$this->assertEquals($dbuser->country, $user1['country']);
+ $this->assertEquals($dbuser->department, $user1['department']);
+ $this->assertEquals($dbuser->institution, $user1['institution']);
+ $this->assertEquals($dbuser->phone1, $user1['phone1']);
+ $this->assertEquals($dbuser->maildisplay, $user1['maildisplay']);
$this->assertEquals('atto', get_user_preferences('htmleditor', null, $dbuser));
$this->assertEquals(null, get_user_preferences('invalidpreference', null, $dbuser));
+ // Confirm user interests have been saved.
+ $interests = core_tag_tag::get_item_tags_array('core', 'user', $createduser['id'], core_tag_tag::BOTH_STANDARD_AND_NOT,
+ 0, false);
+ // There should be 3 user interests.
+ $this->assertCount(3, $interests);
}
// Call without required capability
], [
'type' => 'invialidpreference',
'value' => 'abcd'
- ]]
- );
+ ]
+ ],
+ 'department' => 'College of Science',
+ 'institution' => 'National Institute of Physics',
+ 'phone1' => '01 2345 6789',
+ 'maildisplay' => 1,
+ 'interests' => 'badminton, basketball, cooking, '
+ );
$context = context_system::instance();
$roleid = $this->assignUserCapability('moodle/user:update', $context->id);
$this->assertEquals($dbuser->city, $user1['city']);
$this->assertEquals($dbuser->country, $user1['country']);
$this->assertNotEquals(0, $dbuser->picture, 'Picture must be set to the new icon itemid for this user');
+ $this->assertEquals($dbuser->department, $user1['department']);
+ $this->assertEquals($dbuser->institution, $user1['institution']);
+ $this->assertEquals($dbuser->phone1, $user1['phone1']);
+ $this->assertEquals($dbuser->maildisplay, $user1['maildisplay']);
$this->assertEquals('atto', get_user_preferences('htmleditor', null, $dbuser));
$this->assertEquals(null, get_user_preferences('invalidpreference', null, $dbuser));
+ // Confirm user interests have been saved.
+ $interests = core_tag_tag::get_item_tags_array('core', 'user', $user1['id'], core_tag_tag::BOTH_STANDARD_AND_NOT, 0, false);
+ // There should be 3 user interests.
+ $this->assertCount(3, $interests);
+
// Confirm no picture change when parameter is not supplied.
unset($user1['userpicture']);
core_user_external::update_users(array($user1));