高章伟
2022-02-18 8b5f4c6c281cfa548f92de52c8021e37aa81901e
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
@isTest
public with sharing class QISToPDFBatchTest {
    public QISToPDFBatchTest() {
 
    }
 
    @testSetup
    static void makeTestQIS() {
        QIS_Report__c qr = new QIS_Report__c(
            RC__c = UserInfo.getUserId(),
            // Photo_1__c = '<img alt="用户添加的图片" src="https://ocsm--stagefull--c.documentforce.com/servlet/rtaImage?eid=a0J10000008VbEm&amp;feoid=00N10000008rsVu&amp;refid=0EM1s0000005LCs" style="height: 666px; width: 500px;"></img>',
            Damage_For_Doc_Or_Pat__c = '有',
            Relation_With_The_Problem__c = '有可能',
            Report_For_Goz__c = '不知道',
            Name = 'QIS012345',
            GeneratedPDFField__c = null,
            QIS_Submit_day__c = Date.Today()
        );
        insert qr;
    }
 
    @IsTest
    static void myTest(){
        
        QIS_Report__c qis =  [select id,name,GeneratedPDFField__c,problem_detail_photo__c,Photo_1__c,Photo_2__c,Photo_3__c,
                                        Photo_4__c,Photo_OSH_1__c,Photo_OSH_2__c,Photo_OSH_3__c,Photo_OSH_4__c from QIS_Report__c];
 
        Test.startTest();
            List<String> ids = new List<String>();
            ids.add(qis.Id);
            Database.executeBatch(new QISToPDFBatch(ids));
        Test.stopTest();
        
    }
 
        @IsTest
    static void myTest1(){
        
        QIS_Report__c qis =  [select id,name,GeneratedPDFField__c,problem_detail_photo__c,Photo_1__c,Photo_2__c,Photo_3__c,
                                        Photo_4__c,Photo_OSH_1__c,Photo_OSH_2__c,Photo_OSH_3__c,Photo_OSH_4__c from QIS_Report__c];
 
        Test.startTest();
            List<String> ids = new List<String>();
            ids.add(qis.Id);
            Database.executeBatch(new QISToPDFBatch(null,null,ids,null));
        Test.stopTest();
        
    }
}