You need to sign in to do that
Don't have an account?
Santhosh Gaddam 3
how to write testclass for my controller
public class Document_TriggerHandler{
// Getting the Document Id and creating a Document Url.
public static string getStrLogoUrl(){
list<Document> lstDocument = [SELECT Id,Name,DeveloperName FROM Document WHERE DeveloperName=:Label.my_Label2];
String strOrgId = UserInfo.getOrganizationId();
string strLogoUrl = System.URL.getSalesforceBaseUrl().toExternalForm() +
'/servlet/servlet.ImageServer?id='+lstDocument[0].Id +
'&oid=' + strOrgId;
system.debug('===>'+strLogoUrl);
return strLogoUrl;
}
public static string getLogoUrl(){
list<Document> documentLst = [SELECT Id,Name,DeveloperName FROM Document WHERE DeveloperName=:Label.My_Label1];
String orgId = UserInfo.getOrganizationId();
String logoUrl = System.URL.getSalesforceBaseUrl().toExternalForm() +
'/servlet/servlet.ImageServer?id='+documentLst[0].Id +
'&oid=' + orgId;
return logoUrl;
}
public String getLoginUrl(){
List<Network> netList= [SELECT Id,Name FROM Network where Name=:Label.MY_Label];
return Network.getLoginUrl(netList[0].Id);
}
}
// Getting the Document Id and creating a Document Url.
public static string getStrLogoUrl(){
list<Document> lstDocument = [SELECT Id,Name,DeveloperName FROM Document WHERE DeveloperName=:Label.my_Label2];
String strOrgId = UserInfo.getOrganizationId();
string strLogoUrl = System.URL.getSalesforceBaseUrl().toExternalForm() +
'/servlet/servlet.ImageServer?id='+lstDocument[0].Id +
'&oid=' + strOrgId;
system.debug('===>'+strLogoUrl);
return strLogoUrl;
}
public static string getLogoUrl(){
list<Document> documentLst = [SELECT Id,Name,DeveloperName FROM Document WHERE DeveloperName=:Label.My_Label1];
String orgId = UserInfo.getOrganizationId();
String logoUrl = System.URL.getSalesforceBaseUrl().toExternalForm() +
'/servlet/servlet.ImageServer?id='+documentLst[0].Id +
'&oid=' + orgId;
return logoUrl;
}
public String getLoginUrl(){
List<Network> netList= [SELECT Id,Name FROM Network where Name=:Label.MY_Label];
return Network.getLoginUrl(netList[0].Id);
}
}
>> https://salesforce.stackexchange.com/questions/230205/test-class-for-a-custom-controller
The above link has an explanation to write a test class to a custom controller, you can try checking for implementing your use case.
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.