Skip to content

Instantly share code, notes, and snippets.

@mxalix258
Created June 26, 2013 01:19
Show Gist options
  • Save mxalix258/5863979 to your computer and use it in GitHub Desktop.
Save mxalix258/5863979 to your computer and use it in GitHub Desktop.
Method for testing a visualforce extension and controller methods.
@isTest
//class name
private class vacationdaysTEST{
//test method
private static testMethod void vacationdaysTEST(){
//instantiate the object on which the extension is defined.
Leave_Request__c lr = new Leave_Request__c();
//instantiate standardcontroller, pass object variable into constructor
ApexPages.StandardController sc = new ApexPages.StandardController(lr);
//instantiate extension controller, pass standard controller variable into constructor
vacationdays controller = new vacationdays(sc);
//executes method within the controller extension
controller.getUserInfo();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment