@isTest
|
public class ESignControllerTest {
|
private static User setupUser(){
|
User u = new User(alias = 'manager', email='manager@acme.com',
|
emailencodingkey='UTF-8', lastname='manager',
|
languagelocalekey='en_US',
|
localesidkey='ja_JP', profileid = System.Label.ProfileId_SystemAdmin,
|
timezonesidkey='Asia/Shanghai',
|
username='manager@acme.com' + Datetime.now().getTime(),
|
ZongjianApprovalManager__c = UserInfo.getUserId()
|
);
|
insert u;
|
return u;
|
}
|
static testMethod void testMethod1() {
|
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
|
if (rectCo.size() == 0) {
|
return;
|
}
|
List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc];
|
if (rectDpt.size() == 0) {
|
return;
|
}
|
User u = setupUser();
|
System.runAs(u){
|
// insert hospital
|
Account company1 = new Account();
|
company1.RecordTypeId = rectCo[0].Id;
|
company1.Name = '病院テスト1';
|
company1.OCM_man_province_txt__c = '江西';
|
List<Account> hps = new Account[]{company1};
|
insert hps;
|
RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
|
List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
|
|
Account depart1 = new Account();
|
depart1.RecordTypeId = rectDpt[0].Id;
|
depart1.Name = '*';
|
depart1.Department_Name__c = '診療科1';
|
depart1.ParentId = dc1s[0].Id;
|
depart1.Department_Class__c = dc1s[0].Id;
|
depart1.Hospital__c = company1.Id;
|
depart1.OCM_man_province_txt__c = '江西';
|
|
insert new Account[] {depart1};
|
|
Opportunity opp = new Opportunity(
|
Name='testOpp1',
|
StageName='引合',
|
CloseDate=Date.today(),
|
AccountId=depart1.Id,
|
Sales_Root__c = '販売店',
|
Competitor__c ='A',
|
Click_Close_Date__c = null,
|
RecordType = rectOpp
|
);
|
insert opp;
|
//注残
|
Statu_Achievements__c Sac = new Statu_Achievements__c(
|
name = 'zhucan_one',
|
Opportunity__c = opp.id,
|
DeliveryDate__c = Date.today(),
|
ContractNO__c = 'ContractNO1',
|
ContractAmount__c = 1000
|
);
|
insert Sac;
|
|
//新建电子签收单
|
eSignForm__c eSignForm = new eSignForm__c();
|
eSignForm.Statu_Achievements__c = Sac.Id;
|
eSignForm.Name = '::测试电子签收单';
|
eSignForm.DNName__c = '112233';
|
eSignForm.AccessoriesQualified__c = true;
|
eSignForm.handleOpinionAgency__c = '哇哈哈哈哈哈哈哈哈';
|
eSignForm.agencyScanDay__c = Date.today();
|
eSignForm.agencySignUpDate__c =Date.today();
|
eSignForm.agencyConfirmDate__c = Date.today();
|
insert eSignForm;
|
|
ESignController.ESignController(eSignForm.Id);
|
|
ESignController.getProfileIdByName('2F2B_服务管理');
|
|
ESignController.OcsmResult('外科事业本部');
|
|
}
|
}
|
}
|