From e8c2f963fde9eeac87d758a423965f1e6a17f714 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Fri, 6 Sep 2019 12:12:27 -0700 Subject: [PATCH] FIX Member::getLastName() now correctly returns the Member surname --- src/Security/Member.php | 4 ++-- tests/php/Security/MemberTest.php | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Security/Member.php b/src/Security/Member.php index d8275f9f6..76e651dc5 100644 --- a/src/Security/Member.php +++ b/src/Security/Member.php @@ -1130,9 +1130,9 @@ class Member extends DataObject */ public function getLastName() { - return $this->owner->Surname; + return $this->Surname; } - + /** * Get the complete name of the member, by default in the format ", ". * Falls back to showing either field on its own. diff --git a/tests/php/Security/MemberTest.php b/tests/php/Security/MemberTest.php index 16ba5bdc5..b41e6f265 100644 --- a/tests/php/Security/MemberTest.php +++ b/tests/php/Security/MemberTest.php @@ -1585,4 +1585,12 @@ class MemberTest extends FunctionalTest $result = $member->changePassword('Password123456789'); // 17 characters long $this->assertTrue($result->isValid()); } + + public function testGetLastName() + { + $member = new Member(); + $member->Surname = 'Johnson'; + + $this->assertSame('Johnson', $member->getLastName(), 'getLastName should proxy to Surname'); + } }