Merge branch '4.5' into 4

This commit is contained in:
Dan Hensby 2020-04-01 19:23:47 +01:00
commit 5bf2ac83ee
No known key found for this signature in database
GPG Key ID: F76D6B5FE0626A99
7 changed files with 16 additions and 5 deletions

View File

@ -56,7 +56,7 @@ Returns the currently logged in [Member](api:SilverStripe\Security\Member) insta
```ss
<% if $CurrentMember %>
Welcome Back, $CurrentMember.FirstName
Welcome back, $CurrentMember.FirstName
<% end_if %>
```

View File

@ -47,7 +47,7 @@ class HomePageTest extends FunctionalTest
$page = $this->get('home/');
$this->assertExactHTMLMatchBySelector("#Welcome", [
'Welcome Back'
'Welcome back'
]);
}
}

View File

@ -276,7 +276,7 @@ en:
SURNAME: Surname
VALIDATIONADMINLOSTACCESS: 'Cannot remove all admin groups from your profile'
ValidationIdentifierFailed: 'Can''t overwrite existing member #{id} with identical identifier ({name} = {value}))'
WELCOMEBACK: 'Welcome Back, {firstname}'
WELCOMEBACK: 'Welcome back, {firstname}'
YOUROLDPASSWORD: 'Your old password'
belongs_many_many_Groups: Groups
db_Locale: 'Interface Locale'

View File

@ -55,7 +55,7 @@ class MigrationTask extends BuildTask
protected $title = "Database Migrations";
protected $description = "Provide atomic database changes (not implemented yet)";
protected $description = "Provide atomic database changes (subclass this and implement yourself)";
public function run($request)
{

View File

@ -201,7 +201,7 @@ class LoginHandler extends RequestHandler
// Welcome message
$message = _t(
'SilverStripe\\Security\\Member.WELCOMEBACK',
'Welcome Back, {firstname}',
'Welcome back, {firstname}',
['firstname' => $member->FirstName]
);
Security::singleton()->setSessionMessage($message, ValidationResult::TYPE_GOOD);

View File

@ -174,6 +174,7 @@ class Diff extends \Diff
$content = $content ? "true" : "false";
}
if (is_array($content)) {
$content = array_filter($content, 'is_scalar');
// Convert array to CSV
$content = implode(',', $content);
}

View File

@ -77,4 +77,14 @@ class DiffTest extends SapphireTest
$this->assertRegExp($expected, $actual);
}
public function testDiffArray()
{
$from = ['Lorem', ['array here please ignore'], 'ipsum dolor'];
$to = 'Lorem,ipsum';
$expected = "/^Lorem,ipsum *<del>dolor<\/del> *$/";
$actual = Diff::compareHTML($from, $to);
$this->assertRegExp($expected, $actual);
}
}