From 1727a4f4d02e429475608e60f142a63bc24127bc Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期一, 23 十月 2023 10:07:34 +0800
Subject: [PATCH] 近期修改
---
force-app/main/default/classes/eSignFormAttachmentControllerTest.cls | 71 +++++++++++++++++++++++++++--------
1 files changed, 55 insertions(+), 16 deletions(-)
diff --git a/force-app/main/default/classes/eSignFormAttachmentControllerTest.cls b/force-app/main/default/classes/eSignFormAttachmentControllerTest.cls
index d2192aa..c7a4e03 100644
--- a/force-app/main/default/classes/eSignFormAttachmentControllerTest.cls
+++ b/force-app/main/default/classes/eSignFormAttachmentControllerTest.cls
@@ -108,28 +108,67 @@
eSignForm.DNName__c = '112233';
insert eSignForm;
- list<Attachment> attachmentList = new list<Attachment>();
- Attachment attach=new Attachment();
- attach.Name='A-65224941-20200923--1.docx';
- Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
- attach.body=bodyBlob;
- attach.parentId=eSignForm.id;
- attach.ContentType = 'application/pdf';
- attachmentList.add(attach);
- Attachment attach1=new Attachment();
- attach1.Name='H-65224945-20200928--15.jpg';
- Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
- attach1.body=bodyBlob1;
- attach1.parentId=eSignForm.id;
- attach1.ContentType = 'application/pdf';
- attachmentList.add(attach1);
- insert attachmentList;
+
+ Test.startTest();
+ ContentVersion version = new ContentVersion(
+ Title = 'A-65224941-20200923--1.docx',
+ VersionData = EncodingUtil.base64Decode('test'),
+ ContentLocation = 's',
+ PathOnClient = 'test.txt'
+ );
+ insert version;
+ version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
+ ContentDocumentLink link = new ContentDocumentLink();
+ link.ContentDocumentId = version.ContentDocumentId;
+ link.LinkedEntityId = eSignForm.id;
+ link.ShareType = 'I';
+ link.Visibility = 'AllUsers';
+ insert link;
+
+ ContentVersion version1 = new ContentVersion(
+ Title = 'H-65224945-20200928--15.jpg',
+ VersionData = EncodingUtil.base64Decode('test'),
+ ContentLocation = 's',
+ PathOnClient = 'test.txt'
+ );
+ insert version1;
+ version1 = [select ContentDocumentId from ContentVersion where Id =: version1.Id];
+ ContentDocumentLink link1 = new ContentDocumentLink();
+ link1.ContentDocumentId = version1.ContentDocumentId;
+ link1.LinkedEntityId = eSignForm.id;
+ link1.ShareType = 'I';
+ link1.Visibility = 'AllUsers';
+ insert link1;
+
+
+
+
+
+ // list<Attachment> attachmentList = new list<Attachment>();
+ // Attachment attach=new Attachment();
+ // attach.Name='A-65224941-20200923--1.docx';
+ // Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
+ // attach.body=bodyBlob;
+ // attach.parentId=eSignForm.id;
+ // attach.ContentType = 'application/pdf';
+ // attachmentList.add(attach);
+
+ // Attachment attach1=new Attachment();
+ // attach1.Name='H-65224945-20200928--15.jpg';
+ // Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
+ // attach1.body=bodyBlob1;
+ // attach1.parentId=eSignForm.id;
+ // attach1.ContentType = 'application/pdf';
+ // attachmentList.add(attach1);
+
+ // insert attachmentList;
PageReference page = new PageReference('/apex/eSignFormAttachment?parentId='+eSignForm.id);
System.Test.setCurrentPage(page);
eSignFormAttachmentController eSign = new eSignFormAttachmentController();
eSign.init();
+ Test.stopTest();
}
}
\ No newline at end of file
--
Gitblit v1.9.1