I am unable to cover the below function in test class as siteId
is always returned null
Id siteId = Site.getSiteId();
if (siteId != null) {
//Community user logic -- THIS IS THE PART THAT IS NOT COVERED
} else {
//Non-Community User Logic
}
I have tried including Test.isRunningTest()
but then it causes a problem with the else block being covered...
I have checked the Site.createPortalUser
documentation and also found similar question for the same : Known Question
These are very old threads and was wondering if there were any recents updates to solve this issue now.. Any known solutions or pointers that could help?
Thanks in advance.