You need to sign in to do that
Don't have an account?
Itayb34
Test coverage for SelfService Details on Case Object
Hello
I have a controller that shows on a Case if the contact is an active self-service user and its last login date.
Controller:
public with sharing class stampLoginDetailsforPortalUser { private Case UserCase; public stampLoginDetailsforPortalUser(ApexPages.StandardController stdController) { Case temp = (Case) stdController.getRecord(); this.UserCase = [select contactID from Case where ID = :temp.ID]; } public List<SelfServiceUser> getloginInfo(){ List<SelfServiceUser> us=[Select Id,LastLoginDate,IsActive,ContactId from SelfServiceUser where ContactId=:UserCase.ContactId]; if(us.size()==0){ ApexPages.addmessage(new ApexPages.message(ApexPages.Severity.INFO, 'Login for self service portal user not enabled')); } return us; } }
Visualforce Page:
<apex:page standardController="Case" extensions="stampLoginDetailsforPortalUser"> <apex:pageMessages /> <apex:pageBlock rendered="{!loginInfo.size >0}"> <apex:pageBlockTable value="{!loginInfo}" var="a"> <apex:column headerValue="Last Login" value="{!a.LastLoginDate}"/> <apex:column headerValue="IsActive" value="{!a.IsActive}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:page>
I'm having difficulties with the test coverage...I can't create a test self service user, so I'm not sure how to cover this...
Any help?
Thanks!
Itay
Sorry I misread this.
Strange but true, self-service users aren't stored in the User object:
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_selfserviceuser.htm