From 80a3f59e2d3df07805bc67e329300b8de90a5b3a Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 11 七月 2023 14:13:08 +0800
Subject: [PATCH] Merge branch 'LEXCommunityLiJun' into LEXUpgrade2023-Deloitte
---
force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls | 105 ++++++++++++++++++++++------------------------------
1 files changed, 44 insertions(+), 61 deletions(-)
diff --git a/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls b/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls
index 88d691b..938de55 100644
--- a/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls
+++ b/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls
@@ -1,69 +1,52 @@
@isTest(SeeAllData=true)
private class Batch_FixAttachmentToFilesTest {
- @isTest(SeeAllData=true)
- static void testInit() {
- String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
- .get('Agency')
- .getRecordTypeId();
- Account accountItem1 = new Account(
- Name = 'Testaccount001',
- RecordTypeId = rectCo
- );
- insert accountItem1;
+ @isTest(SeeAllData=true)
+ static void testInit() {
+ String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();
+ Account accountItem1 = new Account(Name = 'Testaccount001', RecordTypeId = rectCo);
+ insert accountItem1;
- Consumable_order__c consOrder = new Consumable_order__c();
- consOrder.Name = 'test01';
- consOrder.Order_status__c = '鎵瑰噯';
- consOrder.Deliver_date__c = Date.today();
- consOrder.RecordTypeid = System.Label.RT_ConOrder_Delivery;
- consOrder.Order_type__c = '璁㈠崟';
- consOrder.Order_ProType__c = 'ENG';
- consOrder.Dealer_Info__c = accountItem1.Id;
- consOrder.Delivery_detail_count__c = 5;
- insert consOrder;
+ Consumable_order__c consOrder = new Consumable_order__c();
+ consOrder.Name = 'test01';
+ consOrder.Order_status__c = '鎵瑰噯';
+ consOrder.Deliver_date__c = Date.today();
+ consOrder.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+ consOrder.Order_type__c = '璁㈠崟';
+ consOrder.Order_ProType__c = 'ENG';
+ consOrder.Dealer_Info__c = accountItem1.Id;
+ consOrder.Delivery_detail_count__c = 5;
+ insert consOrder;
- List<Attachment> attachList = 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 = consOrder.Id;
- attachList.add(attach);
- insert attachList;
+ List<Attachment> attachList = 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 = consOrder.Id;
+ attachList.add(attach);
+ insert attachList;
- Set<String> Id = new Set<String>();
- String objectType;
- Datetime creStartDate;
- Datetime creEndDate;
+ Set<String> Id = new Set<String>();
+ String objectType;
+ Datetime creStartDate;
+ Datetime creEndDate;
- List<Attachment> attachmentList = [
- SELECT
- Id,
- Name,
- OwnerId,
- ParentId,
- Parent.Name,
- Parent.Type,
- Body,
- CreatedDate,
- CreatedById
- FROM Attachment
- WHERE Id = :attachList[0].Id
- ORDER BY CreatedDate ASC
- LIMIT 1
- ];
- for (Attachment att : attachmentList) {
- Id.add(att.ParentId);
- objectType = att.Parent.Name;
- creStartDate = att.CreatedDate;
- creEndDate = att.CreatedDate.addDays(1);
+ List<Attachment> attachmentList = [
+ SELECT Id, Name, OwnerId, ParentId, Parent.Name, Parent.Type, Body, CreatedDate, CreatedById
+ FROM Attachment
+ WHERE Id = :attachList[0].Id
+ ORDER BY CreatedDate ASC
+ LIMIT 1
+ ];
+ for (Attachment att : attachmentList) {
+ Id.add(att.ParentId);
+ objectType = att.Parent.Name;
+ creStartDate = att.CreatedDate;
+ creEndDate = att.CreatedDate.addDays(1);
+ }
+ System.Test.startTest();
+ Database.executeBatch(new Batch_FixAttachmentToFiles(objectType, creStartDate, creEndDate), 1);
+ Database.executeBatch(new Batch_FixAttachmentToFiles(Id), 1);
+ System.Test.stopTest();
}
- System.Test.startTest();
- Database.executeBatch(
- new Batch_FixAttachmentToFiles(objectType, creStartDate, creEndDate),
- 1
- );
- Database.executeBatch(new Batch_FixAttachmentToFiles(Id), 1);
- System.Test.stopTest();
- }
}
--
Gitblit v1.9.1