From d8dc84a3d56df839895f1c417a4d9cbee763d262 Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期五, 03 三月 2023 14:50:59 +0800
Subject: [PATCH] gzw 测试环境代码更新
---
force-app/main/default/classes/StatusPageControllerTest.cls | 525 +++++++++++++++++++++++++++++----------------------------
1 files changed, 268 insertions(+), 257 deletions(-)
diff --git a/force-app/main/default/classes/StatusPageControllerTest.cls b/force-app/main/default/classes/StatusPageControllerTest.cls
index 7416c85..9d0b0a5 100644
--- a/force-app/main/default/classes/StatusPageControllerTest.cls
+++ b/force-app/main/default/classes/StatusPageControllerTest.cls
@@ -16,60 +16,62 @@
Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
- User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
- insert hpOwner;
- User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
- insert hpOwner2;
+ //User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
+ //insert hpOwner;
+ //User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
+ //insert hpOwner2;
+
+ User thisUser = [select Id from User where Id = :UserInfo.getUserId() ];
+ System.runAs ( thisUser ){
+
+ Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = thisUser.Id);
+ hp.FSE_GI_Main_Leader__c = thisUser.Id;
+ hp.FSE_SP_Main_Leader__c = thisUser.Id;
+ insert hp;
+
+ //鎴樼暐绉戝
+ Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
+
+ Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
+ dpt.Name = '*';
+ dpt.Department_Name__c = 'TestDepart';
+ dpt.ParentId = dc.Id;
+ dpt.Department_Class__c = dc.Id;
+ dpt.Hospital__c = hp.Id;
+ insert dpt;
+
+ Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
+ dpt1.Name = '*';
+ dpt1.Department_Name__c = 'TestDepart1';
+ dpt1.ParentId = dc.Id;
+ dpt1.Department_Class__c = dc.Id;
+ dpt1.Hospital__c = hp.Id;
+ insert dpt1;
-
- Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
- hp.FSE_GI_Main_Leader__c = hpOwner.Id;
- hp.FSE_SP_Main_Leader__c = hpOwner2.Id;
- insert hp;
-
- //鎴樼暐绉戝
- Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
-
- Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
- dpt.Name = '*';
- dpt.Department_Name__c = 'TestDepart';
- dpt.ParentId = dc.Id;
- dpt.Department_Class__c = dc.Id;
- dpt.Hospital__c = hp.Id;
- insert dpt;
-
- Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
- dpt1.Name = '*';
- dpt1.Department_Name__c = 'TestDepart1';
- dpt1.ParentId = dc.Id;
- dpt1.Department_Class__c = dc.Id;
- dpt1.Hospital__c = hp.Id;
- insert dpt1;
-
-
- Inquiry_form__c inquiryform = new Inquiry_form__c();
- // inquiryform.Name = '2019102101';
- inquiryform.Hospital_Name__c = dpt1.Id;
- List<Account> dpecList = [select Id,Department_Class__c from Account where Id =: dpt1.Id];
- inquiryform.Department_Class__c = dpecList[0].Department_Class__c;
- inquiryform.Status__c ='01.鏈窡杩�';
- inquiryform.Company__c ='鍖椾含鏌愭煇鏌愭祴璇曞叕鍙�';
- inquiryform.Family_Name__c ='闈�';
- inquiryform.Opportunity_Division__c = '璇环';
- inquiryform.Phone__c = '13844756322';
- inquiryform.Product1__c = '瓒呭0';
- inquiryform.Request1__c = '闇�瑕佹姤浠�';
- inquiryform.Reasons_options__c = '宸茬粡鏈夎浠�';
- Test.startTest();
- insert inquiryform;
- PageReference page = new PageReference('/apex/StatusPage?id='+inquiryform.Id);
- System.Test.setCurrentPage(page);
- StatusPageController controller = new StatusPageController();
- controller.init();
- controller.save();
- controller.savefo();
- controller.servicesavefo();
+ Inquiry_form__c inquiryform = new Inquiry_form__c();
+ // inquiryform.Name = '2019102101';
+ inquiryform.Hospital_Name__c = dpt1.Id;
+ List<Account> dpecList = [select Id,Department_Class__c from Account where Id =: dpt1.Id];
+ inquiryform.Department_Class__c = dpecList[0].Department_Class__c;
+ inquiryform.Status__c ='01.鏈窡杩�';
+ inquiryform.Company__c ='鍖椾含鏌愭煇鏌愭祴璇曞叕鍙�';
+ inquiryform.Family_Name__c ='闈�';
+ inquiryform.Opportunity_Division__c = '璇环';
+ inquiryform.Phone__c = '13844756322';
+ inquiryform.Product1__c = '瓒呭0';
+ inquiryform.Request1__c = '闇�瑕佹姤浠�';
+ inquiryform.Reasons_options__c = '宸茬粡鏈夎浠�';
+ Test.startTest();
+ insert inquiryform;
+ PageReference page = new PageReference('/apex/StatusPage?id='+inquiryform.Id);
+ System.Test.setCurrentPage(page);
+ StatusPageController controller = new StatusPageController();
+ controller.init();
+ controller.save();
+ controller.savefo();
+ controller.servicesavefo();
+ }
}
static testMethod void testMethod2() {
//鍖婚櫌
@@ -86,61 +88,63 @@
Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
- User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
- insert hpOwner;
- User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
- insert hpOwner2;
+ //User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
+ //insert hpOwner;
+ //User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
+ //insert hpOwner2;
+
+ User thisUser = [select Id from User where Id = :UserInfo.getUserId() ];
+ System.runAs ( thisUser ){
+
+ Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = thisUser.Id);
+ hp.FSE_GI_Main_Leader__c = thisUser.Id;
+ hp.FSE_SP_Main_Leader__c = thisUser.Id;
+ insert hp;
+
+ //鎴樼暐绉戝
+ Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
+
+ Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
+ dpt.Name = '*';
+ dpt.Department_Name__c = 'TestDepart';
+ dpt.ParentId = dc.Id;
+ dpt.Department_Class__c = dc.Id;
+ dpt.Hospital__c = hp.Id;
+ insert dpt;
+
+ Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
+ dpt1.Name = '*';
+ dpt1.Department_Name__c = 'TestDepart1';
+ dpt1.ParentId = dc.Id;
+ dpt1.Department_Class__c = dc.Id;
+ dpt1.Hospital__c = hp.Id;
+ insert dpt1;
-
- Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
- hp.FSE_GI_Main_Leader__c = hpOwner.Id;
- hp.FSE_SP_Main_Leader__c = hpOwner2.Id;
- insert hp;
-
- //鎴樼暐绉戝
- Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
-
- Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
- dpt.Name = '*';
- dpt.Department_Name__c = 'TestDepart';
- dpt.ParentId = dc.Id;
- dpt.Department_Class__c = dc.Id;
- dpt.Hospital__c = hp.Id;
- insert dpt;
-
- Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
- dpt1.Name = '*';
- dpt1.Department_Name__c = 'TestDepart1';
- dpt1.ParentId = dc.Id;
- dpt1.Department_Class__c = dc.Id;
- dpt1.Hospital__c = hp.Id;
- insert dpt1;
-
-
- Inquiry_form__c inquiryform = new Inquiry_form__c();
- // inquiryform.Name = '2019102101';
- inquiryform.Hospital_Name__c = dpt1.Id;
- List<Account> dpecList = [select Id,Department_Class__c from Account where Id =: dpt1.Id];
- inquiryform.Department_Class__c = dpecList[0].Department_Class__c;
- inquiryform.Status__c ='01.鏈窡杩�';
- inquiryform.Company__c ='鍖椾含鏌愭煇鏌愭祴璇曞叕鍙�';
- inquiryform.Family_Name__c ='闈�';
- inquiryform.Opportunity_Division__c = '璇环';
- inquiryform.Phone__c = '13844756322';
- inquiryform.Product1__c = '瓒呭0';
- inquiryform.Request1__c = '闇�瑕佹姤浠�';
- inquiryform.Reasons_options__c = '瀹㈡埛鏃犳剰鍚�';
- inquiryform.Follow_Content__c = '';
- Test.startTest();
- insert inquiryform;
- PageReference page = new PageReference('/apex/StatusPage?id='+inquiryform.Id);
- System.Test.setCurrentPage(page);
- StatusPageController controller = new StatusPageController();
- controller.init();
- controller.save();
- controller.savefo();
- controller.servicesavefo();
+ Inquiry_form__c inquiryform = new Inquiry_form__c();
+ // inquiryform.Name = '2019102101';
+ inquiryform.Hospital_Name__c = dpt1.Id;
+ List<Account> dpecList = [select Id,Department_Class__c from Account where Id =: dpt1.Id];
+ inquiryform.Department_Class__c = dpecList[0].Department_Class__c;
+ inquiryform.Status__c ='01.鏈窡杩�';
+ inquiryform.Company__c ='鍖椾含鏌愭煇鏌愭祴璇曞叕鍙�';
+ inquiryform.Family_Name__c ='闈�';
+ inquiryform.Opportunity_Division__c = '璇环';
+ inquiryform.Phone__c = '13844756322';
+ inquiryform.Product1__c = '瓒呭0';
+ inquiryform.Request1__c = '闇�瑕佹姤浠�';
+ inquiryform.Reasons_options__c = '瀹㈡埛鏃犳剰鍚�';
+ inquiryform.Follow_Content__c = '';
+ Test.startTest();
+ insert inquiryform;
+ PageReference page = new PageReference('/apex/StatusPage?id='+inquiryform.Id);
+ System.Test.setCurrentPage(page);
+ StatusPageController controller = new StatusPageController();
+ controller.init();
+ controller.save();
+ controller.savefo();
+ controller.servicesavefo();
+ }
}
static testMethod void testMethod2_1() {
//鍖婚櫌
@@ -157,59 +161,61 @@
Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
- User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
- insert hpOwner;
- User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
- insert hpOwner2;
+ //User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
+ //insert hpOwner;
+ //User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
+ //insert hpOwner2;
+
+ User thisUser = [select Id from User where Id = :UserInfo.getUserId() ];
+ System.runAs ( thisUser ){
+
+ Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = thisUser.Id);
+ hp.FSE_GI_Main_Leader__c = thisUser.Id;
+ hp.FSE_SP_Main_Leader__c = thisUser.Id;
+ insert hp;
+
+ //鎴樼暐绉戝
+ Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
+
+ Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
+ dpt.Name = '*';
+ dpt.Department_Name__c = 'TestDepart';
+ dpt.ParentId = dc.Id;
+ dpt.Department_Class__c = dc.Id;
+ dpt.Hospital__c = hp.Id;
+ insert dpt;
+
+ Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
+ dpt1.Name = '*';
+ dpt1.Department_Name__c = 'TestDepart1';
+ dpt1.ParentId = dc.Id;
+ dpt1.Department_Class__c = dc.Id;
+ dpt1.Hospital__c = hp.Id;
+ insert dpt1;
-
- Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
- hp.FSE_GI_Main_Leader__c = hpOwner.Id;
- hp.FSE_SP_Main_Leader__c = hpOwner2.Id;
- insert hp;
-
- //鎴樼暐绉戝
- Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
-
- Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
- dpt.Name = '*';
- dpt.Department_Name__c = 'TestDepart';
- dpt.ParentId = dc.Id;
- dpt.Department_Class__c = dc.Id;
- dpt.Hospital__c = hp.Id;
- insert dpt;
-
- Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
- dpt1.Name = '*';
- dpt1.Department_Name__c = 'TestDepart1';
- dpt1.ParentId = dc.Id;
- dpt1.Department_Class__c = dc.Id;
- dpt1.Hospital__c = hp.Id;
- insert dpt1;
-
-
- Inquiry_form__c inquiryform = new Inquiry_form__c();
- // inquiryform.Name = '2019102101';
- inquiryform.Hospital_Name__c = dpt1.Id;
- List<Account> dpecList = [select Id,Department_Class__c from Account where Id =: dpt1.Id];
- inquiryform.Department_Class__c = dpecList[0].Department_Class__c;
- inquiryform.Status__c ='01.鏈窡杩�';
- inquiryform.Company__c ='鍖椾含鏌愭煇鏌愭祴璇曞叕鍙�';
- inquiryform.Family_Name__c ='闈�';
- inquiryform.Opportunity_Division__c = '璇环';
- inquiryform.Phone__c = '13844756322';
- inquiryform.Product1__c = '瓒呭0';
- inquiryform.Request1__c = '闇�瑕佹姤浠�';
- inquiryform.Reasons_options__c = '';
- inquiryform.Follow_Content__c = '';
- Test.startTest();
- insert inquiryform;
- PageReference page = new PageReference('/apex/StatusPage?id='+inquiryform.Id);
- System.Test.setCurrentPage(page);
- StatusPageController controller = new StatusPageController();
- controller.init();
- controller.save();
+ Inquiry_form__c inquiryform = new Inquiry_form__c();
+ // inquiryform.Name = '2019102101';
+ inquiryform.Hospital_Name__c = dpt1.Id;
+ List<Account> dpecList = [select Id,Department_Class__c from Account where Id =: dpt1.Id];
+ inquiryform.Department_Class__c = dpecList[0].Department_Class__c;
+ inquiryform.Status__c ='01.鏈窡杩�';
+ inquiryform.Company__c ='鍖椾含鏌愭煇鏌愭祴璇曞叕鍙�';
+ inquiryform.Family_Name__c ='闈�';
+ inquiryform.Opportunity_Division__c = '璇环';
+ inquiryform.Phone__c = '13844756322';
+ inquiryform.Product1__c = '瓒呭0';
+ inquiryform.Request1__c = '闇�瑕佹姤浠�';
+ inquiryform.Reasons_options__c = '';
+ inquiryform.Follow_Content__c = '';
+ Test.startTest();
+ insert inquiryform;
+ PageReference page = new PageReference('/apex/StatusPage?id='+inquiryform.Id);
+ System.Test.setCurrentPage(page);
+ StatusPageController controller = new StatusPageController();
+ controller.init();
+ controller.save();
+ }
}
static testMethod void testMethod3() {
//鍖婚櫌
@@ -226,61 +232,64 @@
Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
- User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
- insert hpOwner;
- User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
- insert hpOwner2;
+ //User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
+ //insert hpOwner;
+ //User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
+ //insert hpOwner2;
+
+ User thisUser = [select Id from User where Id = :UserInfo.getUserId() ];
+ System.runAs ( thisUser ){
+ Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = thisUser.Id);
+ hp.FSE_GI_Main_Leader__c = thisUser.Id;
+ hp.FSE_SP_Main_Leader__c = thisUser.Id;
+ insert hp;
- Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
- hp.FSE_GI_Main_Leader__c = hpOwner.Id;
- hp.FSE_SP_Main_Leader__c = hpOwner2.Id;
- insert hp;
+ //鎴樼暐绉戝
+ Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
- //鎴樼暐绉戝
- Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
+ Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
+ dpt.Name = '*';
+ dpt.Department_Name__c = 'TestDepart';
+ dpt.ParentId = dc.Id;
+ dpt.Department_Class__c = dc.Id;
+ dpt.Hospital__c = hp.Id;
+ insert dpt;
- Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
- dpt.Name = '*';
- dpt.Department_Name__c = 'TestDepart';
- dpt.ParentId = dc.Id;
- dpt.Department_Class__c = dc.Id;
- dpt.Hospital__c = hp.Id;
- insert dpt;
-
- Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
- dpt1.Name = '*';
- dpt1.Department_Name__c = 'TestDepart1';
- dpt1.ParentId = dc.Id;
- dpt1.Department_Class__c = dc.Id;
- dpt1.Hospital__c = hp.Id;
- insert dpt1;
+ Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
+ dpt1.Name = '*';
+ dpt1.Department_Name__c = 'TestDepart1';
+ dpt1.ParentId = dc.Id;
+ dpt1.Department_Class__c = dc.Id;
+ dpt1.Hospital__c = hp.Id;
+ insert dpt1;
- Inquiry_form__c inquiryform = new Inquiry_form__c();
- // inquiryform.Name = '2019102101';
- inquiryform.Hospital_Name__c = dpt1.Id;
- List<Account> dpecList = [select Id,Department_Class__c from Account where Id =: dpt1.Id];
- inquiryform.Department_Class__c = dpecList[0].Department_Class__c;
- inquiryform.Status__c ='01.鏈窡杩�';
- inquiryform.Company__c ='鍖椾含鏌愭煇鏌愭祴璇曞叕鍙�';
- inquiryform.Family_Name__c ='闈�';
- inquiryform.Opportunity_Division__c = '璇环';
- inquiryform.Phone__c = '13844756322';
- inquiryform.Product1__c = '瓒呭0';
- inquiryform.Request1__c = '闇�瑕佹姤浠�';
- inquiryform.Reasons_options__c = '瀹㈡埛鏃犳剰鍚�';
- inquiryform.Follow_Content_Other__c = '';
- inquiryform.Follow_Content__c = '';
- Test.startTest();
- insert inquiryform;
- PageReference page = new PageReference('/apex/FollowPage?id='+inquiryform.Id);
- System.Test.setCurrentPage(page);
- StatusPageController controller = new StatusPageController();
- controller.init();
- controller.savefo();
- controller.servicesavefo();
+ Inquiry_form__c inquiryform = new Inquiry_form__c();
+ // inquiryform.Name = '2019102101';
+ inquiryform.Hospital_Name__c = dpt1.Id;
+ List<Account> dpecList = [select Id,Department_Class__c from Account where Id =: dpt1.Id];
+ inquiryform.Department_Class__c = dpecList[0].Department_Class__c;
+ inquiryform.Status__c ='01.鏈窡杩�';
+ inquiryform.Company__c ='鍖椾含鏌愭煇鏌愭祴璇曞叕鍙�';
+ inquiryform.Family_Name__c ='闈�';
+ inquiryform.Opportunity_Division__c = '璇环';
+ inquiryform.Phone__c = '13844756322';
+ inquiryform.Product1__c = '瓒呭0';
+ inquiryform.Request1__c = '闇�瑕佹姤浠�';
+ inquiryform.Reasons_options__c = '瀹㈡埛鏃犳剰鍚�';
+ inquiryform.Follow_Content_Other__c = '';
+ inquiryform.Follow_Content__c = '';
+ Test.startTest();
+ insert inquiryform;
+ PageReference page = new PageReference('/apex/FollowPage?id='+inquiryform.Id);
+ System.Test.setCurrentPage(page);
+ StatusPageController controller = new StatusPageController();
+ controller.init();
+ controller.savefo();
+ controller.servicesavefo();
+ }
}
static testMethod void testMethod4() {
//鍖婚櫌
@@ -297,60 +306,62 @@
Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
- User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
- insert hpOwner;
- User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
- insert hpOwner2;
+ //User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
+ //insert hpOwner;
+ //User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
+ //insert hpOwner2;
+
+ User thisUser = [select Id from User where Id = :UserInfo.getUserId() ];
+ System.runAs ( thisUser ){
+
+ Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = thisUser.Id);
+ hp.FSE_GI_Main_Leader__c = thisUser.Id;
+ hp.FSE_SP_Main_Leader__c = thisUser.Id;
+ insert hp;
+
+ //鎴樼暐绉戝
+ Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
+
+ Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
+ dpt.Name = '*';
+ dpt.Department_Name__c = 'TestDepart';
+ dpt.ParentId = dc.Id;
+ dpt.Department_Class__c = dc.Id;
+ dpt.Hospital__c = hp.Id;
+ insert dpt;
+
+ Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
+ dpt1.Name = '*';
+ dpt1.Department_Name__c = 'TestDepart1';
+ dpt1.ParentId = dc.Id;
+ dpt1.Department_Class__c = dc.Id;
+ dpt1.Hospital__c = hp.Id;
+ insert dpt1;
-
- Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
- hp.FSE_GI_Main_Leader__c = hpOwner.Id;
- hp.FSE_SP_Main_Leader__c = hpOwner2.Id;
- insert hp;
-
- //鎴樼暐绉戝
- Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
-
- Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
- dpt.Name = '*';
- dpt.Department_Name__c = 'TestDepart';
- dpt.ParentId = dc.Id;
- dpt.Department_Class__c = dc.Id;
- dpt.Hospital__c = hp.Id;
- insert dpt;
-
- Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
- dpt1.Name = '*';
- dpt1.Department_Name__c = 'TestDepart1';
- dpt1.ParentId = dc.Id;
- dpt1.Department_Class__c = dc.Id;
- dpt1.Hospital__c = hp.Id;
- insert dpt1;
-
-
- Inquiry_form__c inquiryform = new Inquiry_form__c();
- // inquiryform.Name = '2019102101';
- inquiryform.Hospital_Name__c = dpt1.Id;
- List<Account> dpecList = [select Id,Department_Class__c from Account where Id =: dpt1.Id];
- inquiryform.Department_Class__c = dpecList[0].Department_Class__c;
- inquiryform.Status__c ='01.鏈窡杩�';
- inquiryform.Company__c ='鍖椾含鏌愭煇鏌愭祴璇曞叕鍙�';
- inquiryform.Family_Name__c ='闈�';
- inquiryform.Opportunity_Division__c = '璇环';
- inquiryform.Phone__c = '13844756322';
- inquiryform.Product1__c = '瓒呭0';
- inquiryform.Request1__c = '闇�瑕佹姤浠�';
- inquiryform.Reasons_options__c = '瀹㈡埛鏃犳剰鍚�';
- inquiryform.Follow_Content_Other__c = '';
- inquiryform.Follow_Content__c = '鍏朵粬';
- Test.startTest();
- insert inquiryform;
- PageReference page = new PageReference('/apex/FollowPage?id='+inquiryform.Id);
- System.Test.setCurrentPage(page);
- StatusPageController controller = new StatusPageController();
- controller.init();
- controller.savefo();
- controller.servicesavefo();
+ Inquiry_form__c inquiryform = new Inquiry_form__c();
+ // inquiryform.Name = '2019102101';
+ inquiryform.Hospital_Name__c = dpt1.Id;
+ List<Account> dpecList = [select Id,Department_Class__c from Account where Id =: dpt1.Id];
+ inquiryform.Department_Class__c = dpecList[0].Department_Class__c;
+ inquiryform.Status__c ='01.鏈窡杩�';
+ inquiryform.Company__c ='鍖椾含鏌愭煇鏌愭祴璇曞叕鍙�';
+ inquiryform.Family_Name__c ='闈�';
+ inquiryform.Opportunity_Division__c = '璇环';
+ inquiryform.Phone__c = '13844756322';
+ inquiryform.Product1__c = '瓒呭0';
+ inquiryform.Request1__c = '闇�瑕佹姤浠�';
+ inquiryform.Reasons_options__c = '瀹㈡埛鏃犳剰鍚�';
+ inquiryform.Follow_Content_Other__c = '';
+ inquiryform.Follow_Content__c = '鍏朵粬';
+ Test.startTest();
+ insert inquiryform;
+ PageReference page = new PageReference('/apex/FollowPage?id='+inquiryform.Id);
+ System.Test.setCurrentPage(page);
+ StatusPageController controller = new StatusPageController();
+ controller.init();
+ controller.savefo();
+ controller.servicesavefo();
+ }
}
}
\ No newline at end of file
--
Gitblit v1.9.1