MDL-72592 block_myprofile: behat and other code fixes
This commit fixes few things: - Fix correct language string order. - Change the code in myprofile.php to be consistent with other checks. - Update provided test to fix behat failure.
This commit is contained in:
@@ -120,13 +120,10 @@ class myprofile implements renderable, templatable {
|
||||
$data->userlastip = $USER->lastip;
|
||||
}
|
||||
|
||||
if (!empty($this->config->display_lastlogin)) {
|
||||
if (empty($USER->lastlogin)) {
|
||||
$data->userlastlogin = 0;
|
||||
} else {
|
||||
$data->userlastlogin = userdate($USER->lastlogin);
|
||||
}
|
||||
if (!empty($this->config->display_lastlogin) && !empty($USER->lastlogin)) {
|
||||
$data->userlastlogin = userdate($USER->lastlogin);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ $string['display_address'] = 'Display address';
|
||||
$string['display_firstaccess'] = 'Display first access';
|
||||
$string['display_lastaccess'] = 'Display last access';
|
||||
$string['display_currentlogin'] = 'Display current login';
|
||||
$string['display_lastlogin'] = 'Display last login';
|
||||
$string['display_lastip'] = 'Display last IP';
|
||||
$string['display_lastlogin'] = 'Display last login';
|
||||
$string['myprofile:addinstance'] = 'Add a new logged in user block';
|
||||
$string['myprofile:myaddinstance'] = 'Add a new logged in user block to Dashboard';
|
||||
$string['myprofile_settings'] = 'Visible user information';
|
||||
|
||||
@@ -237,7 +237,7 @@ Feature: The logged in user block allows users to view their profile information
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | One | teacher1@example.com |
|
||||
And I log in as "teacher1"
|
||||
And I press "Customise this page"
|
||||
And I turn editing mode on
|
||||
When I add the "Logged in user" block
|
||||
And I configure the "Logged in user" block
|
||||
And I set the following fields to these values:
|
||||
@@ -249,4 +249,6 @@ Feature: The logged in user block allows users to view their profile information
|
||||
And I set the following fields to these values:
|
||||
| Display last login | Yes |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I should see "Last login:" in the "Logged in user" "block"
|
||||
|
||||
Reference in New Issue
Block a user