You need to sign in to do that
Don't have an account?
Thaier Issa
Apex Test Class Error: Method does not exist or incorrect signature: void setCurrentPage(System.PageReference) from the type requnl_class_test
I am getting this error when trying to save my test, here is my test code
And here is my class code
Any help would be appreciated :)
@istest (seeAllData = True) private class requnl_class_test { @isTest static void requnl_class_test () { Patient_Details__c client = new Patient_Details__c( Patient_name__c='Donkey Kong', Email_Address__c='tom@tom.com', Phone_number3__c='2012012233' ); insert client; Patient_chart__c chart= new Patient_chart__c ( RESTORE_Client__c=client.Id, name='sard' ); insert chart; ApexPages.currentPage().getParameters().put('id',chart.id); ApexPages.StandardController stdController = new ApexPages.StandardController(chart); requnl_class consext = new requnl_class(stdController); PageReference pageRef = Page.Request_Unlock; setCurrentPage(pageRef); } }
And here is my class code
public without sharing class requnl_class { private ApexPages.StandardController standardController; public String recId {get; set;} public requnl_class(ApexPages.StandardController standardController) { recId=ApexPages.CurrentPage().getparameters().get('id'); this.standardController = standardController; } public PageReference send() { Messaging.singleEmailmessage email = new Messaging.singleEmailmessage(); patient_chart__c PatientId = [SELECT Id FROM patient_chart__c WHERE ID =:recid Limit 1]; List<string>sendTo = new List<String>(); sendTo.add('support@restorehair.com'); email.setToAddresses(sendTo); email.setSubject('Please unlock this patient chart.'); email.setHtmlBody('Please unlock cs28.salesforce.com/'+PatientId.Id); Messaging.sendEmailResult[] r = Messaging.sendEmail(new Messaging.singleEmailmessage[] {email}); return null; } }
Any help would be appreciated :)
All Answers
Please refer to the below code: Hope this will solve your problem. If does then mark it the best answer so it can also help others.
Many Thanks,
Sunil Rathore