From 8badb57ea2c82557850ad5b39281c3e8714eb119 Mon Sep 17 00:00:00 2001
From: liuyan <liuyan@prec-tech.com>
Date: 星期四, 24 十一月 2022 10:08:31 +0800
Subject: [PATCH] 科室信息漏传SPO问题
---
force-app/main/default/classes/ContactTriggerHandlerTest.cls | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 50 insertions(+), 9 deletions(-)
diff --git a/force-app/main/default/classes/ContactTriggerHandlerTest.cls b/force-app/main/default/classes/ContactTriggerHandlerTest.cls
index ef501c9..fc2e86a 100644
--- a/force-app/main/default/classes/ContactTriggerHandlerTest.cls
+++ b/force-app/main/default/classes/ContactTriggerHandlerTest.cls
@@ -6,22 +6,50 @@
public static Contact contact1 = new Contact();
public static Contact contact2 = new Contact();
+ @Testsetup
+ static void setup(){
+ TestDataUtility.CreatePIPolicyConfiguration('Agency_Contact__c');
+
+ }
@isTest static void test_method_one() {
+ List<RecordType> HPrectCo = [select Id, Name, DeveloperName from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
+ List<RecordType> GIrectCo = [select Id, Name, DeveloperName from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_Class_GI'];
+ List<RecordType> DoctorrectCo = [select Id, Name, DeveloperName from RecordType where IsActive = true and SobjectType = 'Contact' and DeveloperName = 'Doctor'];
+ if (HPrectCo.size() == 0) {
+ throw new ControllerUtil.myException('not found HP recordtype');
+ }
+ if (GIrectCo.size() == 0) {
+ throw new ControllerUtil.myException('not found Department_Class_GI recordtype');
+ }
+ if (DoctorrectCo.size() == 0) {
+ throw new ControllerUtil.myException('not found Doctor recordtype');
+ }
// 鍙栧紩鍏�
account1.Name = 'test1鍖婚櫌';
- account1.RecordTypeId = '01210000000QemG';
+ // account1.RecordTypeId = '01210000000QemG';
+ account1.RecordTypeId = HPrectCo[0].Id;
insert account1;
-
// 鍙栧紩鍏堣铂浠昏��
contact1.AccountId = account1.Id;
contact1.FirstName = '璨换鑰�';
contact1.LastName = 'test1鍖婚櫌';
- Account dept = [select Id from Account where RecordTypeId = '01210000000QemL'];
+ Account dept = [select Id from Account where RecordTypeId =: GIrectCo[0].Id];
contact1.Strategic_dept_Class__c = dept.Id;
contact1.MobilePhone = '13409507069';
- contact1.RecordTypeId = '01210000000QfWdAAK';
+ // contact1.RecordTypeId = '01210000000QfWdAAK';
+ contact1.RecordTypeId = DoctorrectCo[0].Id;
contact1.UnifiedI_Contact_ID__c = '100000';
insert contact1;
+
+ contact2.FirstName = 'test';
+ contact2.LastName = 'Data';
+ // contact2.RecordTypeId = '01210000000QfWi';
+ contact2.RecordTypeId = DoctorrectCo[0].Id;
+ contact2.AccountId = account1.Id;
+ contact2.Agency_User__c = true;
+ contact2.MobilePhone = '18999999999';
+ insert contact2;
+
MeetingManagement__c a =
new MeetingManagement__c(Contact__c =contact1.id
,pollingTime__c = 1,
@@ -44,29 +72,42 @@
}
@isTest
static void test_method_two(){
+ List<RecordType> AgencyrectCo1 = [select Id, Name, DeveloperName from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'Agency'];
+ if (AgencyrectCo1.size() == 0) {
+ throw new ControllerUtil.myException('not found AccountAgency recordtype');
+ }
+ List<RecordType> AgencyrectCo2 = [select Id, Name, DeveloperName from RecordType where IsActive = true and SobjectType = 'Contact' and DeveloperName = 'Agency'];
+ if (AgencyrectCo2.size() == 0) {
+ throw new ControllerUtil.myException('not found ContactAgency recordtype');
+ }
account2.Name = 'test2 缁忛攢鍟�';
- account2.RecordTypeId = '01210000000Qem1';
+ // account2.RecordTypeId = '01210000000Qem1';
+ account2.RecordTypeId = AgencyrectCo1[0].Id;
insert account2;
contact2.FirstName = 'test';
contact2.LastName = 'Data';
- contact2.RecordTypeId = '01210000000QfWi';
+ // contact2.RecordTypeId = '01210000000QfWi';
+ contact2.RecordTypeId = AgencyrectCo2[0].Id;
contact2.AccountId = account2.Id;
contact2.Agency_User__c = true;
contact2.MobilePhone = '18999999999';
insert contact2;
- contact2.MobilePhone = '1899999999A';
- update contact2;
Contact contact3 = new Contact();
contact3.FirstName = 'test';
contact3.LastName = 'Data';
- contact3.RecordTypeId = '01210000000QfWi';
+ // contact3.RecordTypeId = '01210000000QfWi';
+ contact3.RecordTypeId = AgencyrectCo2[0].Id;
contact3.AccountId = account2.Id;
// contact3.Agency_User__c = true;
contact3.Ignore_Same_Name__c = true;
contact3.MobilePhone = '';
insert contact3;
+
+ contact2.MobilePhone = '1899999999A';
+ update contact2;
+
List<account> accList = [select Dealer_Num__c From account];
system.assertEquals(accList[0].Dealer_Num__c,1);
--
Gitblit v1.9.1