liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
@isTest
private class RollupToUnprocessToMailBatchTest {
    static testMethod void testMethod1() {
       user UserGI = New User(
            Alias = 'GI_User',
            Email='GI_User@testorg.com',
            EmailEncodingKey='UTF-8',
            LastName='testUserGI',
            Firstname ='GI',
            LanguageLocaleKey='zh_CN',
            LocaleSidKey='zh_CN',
            ProfileId = System.Label.ProfileId_SystemAdmin,
            TimeZoneSidKey='Asia/Shanghai',
            UserName='testUserGI@testorg.com');
        insert UserGI;
 
 
        OPDPlan__c oPDPlan0 = new OPDPlan__c();
        oPDPlan0.Status__c = '提交';
        oPDPlan0.OPDPlan_ImplementDate__c = Date.today().addDays(1);
        oPDPlan0.NoOpp_Reason__c = 'HCP对应';
        oPDPlan0.SalesManager__c = UserGI.id;
        insert oPDPlan0;
 
        Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
        psr.setObjectId(oPDPlan0.id);
        psr.setSubmitterId(UserInfo.getUserId());
        psr.setProcessDefinitionNameOrId('OPDApproval');
        Approval.ProcessResult submitResult = Approval.process(psr);
 
        Id execBTId = Database.executeBatch(new RollupToUnprocessToMailBatch(),200);                
    }
}