Skip to content

Commit

Permalink
test classes for custom settings
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsayer committed Sep 3, 2019
1 parent 661759b commit 6fd7b50
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/classes/C501_CTRL_ClassReg_CreateAcct.cls
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ public class C501_CTRL_ClassReg_CreateAcct {
nextStartDate = Datetime.newInstance(schoolNameText.C501_Next_Program_Start_Date__c, Time.newInstance(0,0,0,0)).format('MMMMM d, yyyy');
}*/

RegistrationSiteSettings__c siteSettings = [SELECT id, Default_From_Email__c FROM RegistrationSiteSettings__c LIMIT 1];
RegistrationSiteSettings__c siteSettings = RegistrationSiteSettings__c.getInstance('default');

Id templateId = [Select id from EmailTemplate where DeveloperName = 'C501_Class_Registration_Confirmation_VF'].Id;

Expand Down
1 change: 1 addition & 0 deletions src/classes/C501_TESTClassReg_Login.cls
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class C501_TESTClassReg_Login {
insert testFamily;

insert new TwilioConfig__c(Name = 'default', AuthToken__c = 'xxx', Default_Send_Number__c = '206222222', AccountSid__c = 'xxx');
insert new RegistrationSiteSettings__c(Name = 'default', Default_From_Email__c = '[email protected]');

}

Expand Down
2 changes: 2 additions & 0 deletions src/classes/C501_TEST_ClassReg_CreateAcct.cls
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class C501_TEST_ClassReg_CreateAcct {

@isTest static void testValidationFail(){
insert new TwilioConfig__c(Name = 'default', AuthToken__c = 'xxx', Default_Send_Number__c = '206222222', AccountSid__c = 'xxx');
insert new RegistrationSiteSettings__c(Name = 'default', Default_From_Email__c = '[email protected]');

Class_Site_Login_Attempt__c att = createLoggedInTestUser();

Expand Down Expand Up @@ -112,6 +113,7 @@ public class C501_TEST_ClassReg_CreateAcct {

@isTest static void testSuccessfulInsert(){
insert new TwilioConfig__c(Name = 'default', AuthToken__c = 'xxx', Default_Send_Number__c = '206222222', AccountSid__c = 'xxx');
insert new RegistrationSiteSettings__c(Name = 'default', Default_From_Email__c = '[email protected]');

Class_Site_Login_Attempt__c att = createLoggedInTestUser();

Expand Down
2 changes: 1 addition & 1 deletion src/classes/C501_UTIL_ClassRegUtilities.cls
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public class C501_UTIL_ClassRegUtilities {
}

public static void sendEmailConfirmation(ID AcctID, String emailAddress){
RegistrationSiteSettings__c siteSettings = [SELECT id, Default_From_Email__c FROM RegistrationSiteSettings__c LIMIT 1];
RegistrationSiteSettings__c siteSettings = RegistrationSiteSettings__c.getInstance('default');
Class_Site_Login_Attempt__c att = generateLoginCode(AcctID, emailAddress);
String message = Label.C501_ClassReg_CodeMessage + ' '+att.Secret_Code__c + ' ' +Label.C501_ClassReg_CodeMessageDisclaim+' '+Label.C501_ClassReg_CodeMessageExpire;
SendEmailGeneric(siteSettings.Default_From_Email__c,emailAddress,Label.C501_ClassReg_ConfirmCodeSubject,message,null,null,null);
Expand Down

0 comments on commit 6fd7b50

Please sign in to comment.