Merge branch '3.4' into 3.5.0

This commit is contained in:
Daniel Hensby 2016-11-09 16:14:40 +00:00
commit 5a7cde0e10
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E
2 changed files with 11 additions and 2 deletions

View File

@ -841,9 +841,8 @@ class Member extends DataObject implements TemplateGlobalProvider {
$id = Member::currentUserID();
if($id) {
return DataObject::get_by_id('Member', $id);
return DataObject::get_by_id('Member', $id) ?: null;
}
return null;
}
/**

View File

@ -1041,6 +1041,16 @@ class MemberTest extends FunctionalTest {
$this->assertTrue($fail, 'Passes with email and surname now (no firstname)');
}
public function testCurrentUser() {
$this->assertNull(Member::currentUser());
$adminMember = $this->objFromFixture('Member', 'admin');
$this->logInAs($adminMember);
$userFromSession = Member::currentUser();
$this->assertEquals($adminMember->ID, $userFromSession->ID);
}
}
/**