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
@IsTest
class LexQISCloneButtonControllerTest {
    public static String qisRecordTypeId = Schema.SObjectType.QIS_Report__c.getRecordTypeInfosByDeveloperName().get('QISRecordType1').getRecordTypeId();
    public static User thisUser = [ SELECT Id from User WHERE Id = :UserInfo.getUserId()];
    @testSetup 
    static void testSetup() {
        System.runAs(thisUser){
            QIS_Report__c qis = new QIS_Report__c(Name = 'Test', RecordTypeId = qisRecordTypeId, QIS_Status__c = '取消');
            insert qis;
        }
    }
 
    @isTest
    static void tesMethod1(){
        System.runAs(thisUser){
            QIS_Report__c qis = [SELECT Id FROM QIS_Report__c WHERE RecordTypeId =:qisRecordTypeId LIMIT 1];
            System.Test.startTest();
            LexQISCloneButtonController lq = new LexQISCloneButtonController();
            LexQISCloneButtonController.checkStatus(qis.Id);
            System.Test.stopTest(); 
        }
    }
}