diff options
-rw-r--r-- | app/Helper/UserHelper.php | 2 | ||||
-rw-r--r-- | tests/units/Helper/UserHelperTest.php | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/app/Helper/UserHelper.php b/app/Helper/UserHelper.php index ee7d8ba5..c3369dfd 100644 --- a/app/Helper/UserHelper.php +++ b/app/Helper/UserHelper.php @@ -34,7 +34,7 @@ class UserHelper extends Base { $initials = ''; - foreach (explode(' ', $name) as $string) { + foreach (explode(' ', $name, 2) as $string) { $initials .= mb_substr($string, 0, 1); } diff --git a/tests/units/Helper/UserHelperTest.php b/tests/units/Helper/UserHelperTest.php index 7ee6e8bb..9a9832b2 100644 --- a/tests/units/Helper/UserHelperTest.php +++ b/tests/units/Helper/UserHelperTest.php @@ -15,6 +15,7 @@ class UserHelperTest extends Base $helper = new UserHelper($this->container); $this->assertEquals('CN', $helper->getInitials('chuck norris')); + $this->assertEquals('CN', $helper->getInitials('chuck norris #2')); $this->assertEquals('A', $helper->getInitials('admin')); } |