You need to sign in to do that
Don't have an account?
Andrew Hoban 14
Creating a test class for a contoller
Hi all, I was wondering if you could help me create a test class for the clontroller seen below. Any help would be appreciated,
Many thanks.
Many thanks.
public class IncidentLogPopup { public List<Incident_Log__c> memberList {get;set;} public List<Incident_Log__c> memberAddList {get;set;} public String memberName {get;set;} public string searchstring {get;set;} public PageReference cancel() { return null; } public IncidentLogPopup() { } public IncidentLogPopup(ApexPages.StandardController controller) { String sql = 'SELECT Match_Day_Ops__c, Date_Time__c, Date_Closed__c, Type__c, Priority__c, Incident__c, Reported_to__c, Reported_By__c, Opened_Closed_Status__c FROM Incident_Log__c'; memberList = Database.Query(sql); memberAddList = new List<Incident_Log__c>(); memberAddList.add(new Incident_Log__c(Match_Day_Ops__c = 'a0Gf000000111CV', Date_Time__c = DateTime.Now())); } public void AddRow() { memberAddList.add(new Incident_Log__c(Match_Day_Ops__c = 'a0Gf000000111CV', Date_Time__c = DateTime.Now())); } Public Pagereference Save(){ insert memberAddlist; PageReference page = new Pagereference('/a0G/o'); page.setRedirect(true); return page; } }
Try with the below code.
All Answers
Refer the below link.
https://developer.salesforce.com/forums?id=906F00000008y7QIAQ
Try with the below code.
Thanks
USE "insert inc;" at Line 7 insted of insert inc.