forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-42812 libraries: Update username_load_fields_from_object to add t…
…he prefix to everything.
- Loading branch information
Showing
7 changed files
with
29 additions
and
13 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 |
---|---|---|
|
@@ -2633,7 +2633,6 @@ public function test_username_load_fields_from_object() { | |
$userinfo->imagealt = 'Michael Jordan draining another basket.'; | ||
$userinfo->idnumber = 3982; | ||
|
||
|
||
// Just user name fields. | ||
$user = new stdClass(); | ||
$user = username_load_fields_from_object($user, $userinfo); | ||
|
@@ -2648,8 +2647,9 @@ public function test_username_load_fields_from_object() { | |
|
||
// User information for showing a picture. | ||
$user = new stdClass(); | ||
$additionalfields = array('id' => 'userid', 'imagealt', 'picture', 'email'); | ||
$additionalfields = explode(',', user_picture::fields()); | ||
$user = username_load_fields_from_object($user, $userinfo, null, $additionalfields); | ||
$user->id = $userinfo->userid; | ||
$expectedarray = new stdClass(); | ||
$expectedarray->id = 1; | ||
$expectedarray->firstname = 'Bruce'; | ||
|
@@ -2669,11 +2669,16 @@ public function test_username_load_fields_from_object() { | |
$userinfo->authorfirstnamephonetic = 'ブルース'; | ||
$userinfo->authorlastnamephonetic = 'カンベッル'; | ||
$userinfo->authormiddlename = ''; | ||
$userinfo->authorpicture = 23; | ||
$userinfo->authorimagealt = 'Michael Jordan draining another basket.'; | ||
$userinfo->authoremail = '[email protected]'; | ||
|
||
|
||
// Return an object with user picture information. | ||
$user = new stdClass(); | ||
$additionalfields = array('id' => 'userid', 'imagealt', 'picture', 'email'); | ||
$additionalfields = explode(',', user_picture::fields()); | ||
$user = username_load_fields_from_object($user, $userinfo, 'author', $additionalfields); | ||
$user->id = $userinfo->userid; | ||
$expectedarray = new stdClass(); | ||
$expectedarray->id = 1; | ||
$expectedarray->firstname = 'Bruce'; | ||
|
@@ -2682,7 +2687,7 @@ public function test_username_load_fields_from_object() { | |
$expectedarray->lastnamephonetic = 'カンベッル'; | ||
$expectedarray->middlename = ''; | ||
$expectedarray->alternatename = ''; | ||
$expectedarray->email = ''; | ||
$expectedarray->email = '[email protected]'; | ||
$expectedarray->picture = 23; | ||
$expectedarray->imagealt = 'Michael Jordan draining another basket.'; | ||
$this->assertEquals($user, $expectedarray); | ||
|
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
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
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