From 928399eceec50e3d37ea08669a12789a9410a9d2 Mon Sep 17 00:00:00 2001
From: 沙世明 <shashiming@prec-tech.com>
Date: 星期二, 22 十一月 2022 16:51:16 +0800
Subject: [PATCH] 111
---
force-app/main/default/classes/NFM007TriggerTest.cls | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 50 insertions(+), 9 deletions(-)
diff --git a/force-app/main/default/classes/NFM007TriggerTest.cls b/force-app/main/default/classes/NFM007TriggerTest.cls
index 621bd37..937b09f 100644
--- a/force-app/main/default/classes/NFM007TriggerTest.cls
+++ b/force-app/main/default/classes/NFM007TriggerTest.cls
@@ -8,6 +8,7 @@
StaticParameter.EscapeNFM001Trigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
+ StaticParameter.EscapeOppandStaTrigger = true;
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
if (rectCo.size() == 0) {
return;
@@ -60,7 +61,6 @@
LicenseAndAccount__c = company1.Id
);
insert linc;
- System.Test.startTest();
// 鍐嶅彇寰�
//List<Id> accountIds = new Id[] {company.Id, section.Id, depart.Id};
//List<Account> accList = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id in :accountIds order by Management_Code__c];
@@ -76,7 +76,24 @@
product.Asset_Model_No__c = '11111';
product.ProductCode = 'OTV-SP1H-NA-12E';
product.MDM_Model_No__c = 'test';
+ product.CanNotCancelledGurantee__c=true;
insert product;
+
+ Product_Register__c prc = new Product_Register__c(Name = '鍥芥娉ㄨ繘20162220210',
+ MedPrdClass__c = '3',
+ ValidFrom__c = date.newinstance(2018, 07, 22),
+ ValidTo__c = date.newinstance(2028, 07, 22),
+ RegisterNoClass_Old__c = '6815',
+ RegisterNoClass_New__c = '6815',
+ RegisterNoStatus__c = '鏈夋晥'
+ );
+ insert prc;
+
+ Product_Register_Link__c prlc = new Product_Register_Link__c(
+ Product2__c = product.Id,
+ Product_Register__c = prc.Id
+ );
+ insert prlc;
PricebookEntry entry = new PricebookEntry( Pricebook2Id=pricebookId, Product2Id=product.Id);
entry.UnitPrice = 0;
@@ -89,7 +106,7 @@
opp.AccountId = depart.Id;
opp.Department_Class__c = section.Id;
opp.Hospital__c = company.Id;
- opp.SAP_Send_OK__c = true;
+ opp.SAP_Send_OK__c = false;
opp.Gurantee_Period__c = '2';
opp.Name = 'GZ-SP-NFM007_1';
opp.Trade__c = '鍐呰部';
@@ -101,6 +118,7 @@
opp.Contract_DB_SalesDept_complite_day__c = date.newinstance(2019, 05, 22);
opp.NotesApprovedNo__c = 'Test20180622';
opp.Estimation_Id__c = '';
+ opp.multiYearWarranty__c =true;
insert opp;
Quote quo = new Quote();
@@ -114,6 +132,8 @@
quo.OCM_Agent1_Price__c = 203;
quo.Pricebook2Id = pricebookId;
insert quo;
+
+ System.Test.startTest();
//QuoteLineItem qli = new QuoteLineItem();
//qli.QuoteId = quo.Id;
@@ -163,6 +183,7 @@
oppli.PricebookEntryId = entry.Id;
insert oppli;
System.Test.stopTest();
+ StaticParameter.EscapeOppandStaTrigger = false;
//Test.startTest();
// NFM007銈堛倞銆侀�佷俊銇椼仾銇勩亾銇�
//System.assertEquals('', NFM007Controller.debug_msg);
@@ -178,6 +199,7 @@
StaticParameter.EscapeNFM001Trigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
+ StaticParameter.EscapeOppandStaTrigger = true;
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
if (rectCo.size() == 0) {
return;
@@ -230,7 +252,6 @@
LicenseAndAccount__c = company1.Id
);
insert linc;
- System.Test.startTest();
// 鍐嶅彇寰�
//List<Id> accountIds = new Id[] {company.Id, section.Id, depart.Id};
//List<Account> accList = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id in :accountIds order by Management_Code__c];
@@ -253,6 +274,7 @@
opp.Contract_DB_SalesDept_complite_day__c = date.newinstance(2019, 05, 22);
opp.NotesApprovedNo__c = 'Test20180622';
opp.Estimation_Id__c = '';
+ opp.multiYearWarranty__c =true;
insert opp;
Quote quo = new Quote();
@@ -266,6 +288,7 @@
quo.OCM_Agent1_Price__c = 203;
quo.Pricebook2Id = pricebookId;
insert quo;
+ System.Test.startTest();
opp.Estimation_Decision__c = true;
opp.Estimation_Id__c = quo.ID;
update opp;
@@ -280,7 +303,7 @@
product3.Asset_Model_No__c = '11111';
product3.MDM_Model_No__c = '123';
product3.ProductCode = 'OTV-SP1H-NA-12E';
-
+ product3.CanNotCancelledGurantee__c=true;
insert product3;
PricebookEntry entry = new PricebookEntry( Pricebook2Id=pricebookId, Product2Id=product3.Id);
@@ -323,6 +346,7 @@
oppli.PricebookEntryId = entry.Id;
insert oppli;
System.Test.stopTest();
+ StaticParameter.EscapeOppandStaTrigger = false;
//Test.startTest();
// NFM007銈堛倞銆侀�佷俊銇椼仾銇勩亾銇�
//System.assertEquals('', NFM007Controller.debug_msg);
@@ -334,7 +358,7 @@
//Test.stopTest();
}
- //static testMethod void testUpdateHospital() {
+ //static testMethod void testUpdateHospital() {
// List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
// if (rectCo.size() == 0) {
// return;
@@ -862,6 +886,7 @@
StaticParameter.EscapeNFM001Trigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
+ StaticParameter.EscapeOppandStaTrigger = true;
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
if (rectCo.size() == 0) {
return;
@@ -914,7 +939,6 @@
LicenseAndAccount__c = company1.Id
);
insert linc;
- System.Test.startTest();
// 鍐嶅彇寰�
//List<Id> accountIds = new Id[] {company.Id, section.Id, depart.Id};
//List<Account> accList = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id in :accountIds order by Management_Code__c];
@@ -937,6 +961,7 @@
opp.Contract_DB_SalesDept_complite_day__c = date.newinstance(2019, 05, 22);
opp.NotesApprovedNo__c = 'Test20180622';
opp.Estimation_Id__c = '';
+ opp.multiYearWarranty__c =true;
insert opp;
Quote quo = new Quote();
@@ -950,6 +975,7 @@
quo.OCM_Agent1_Price__c = 203;
quo.Pricebook2Id = pricebookId;
insert quo;
+ System.Test.startTest();
opp.Estimation_Decision__c = true;
opp.Estimation_Id__c = quo.ID;
update opp;
@@ -964,7 +990,7 @@
product3.Asset_Model_No__c = '11111';
product3.MDM_Model_No__c = '123';
product3.ProductCode = 'OTV-SP1H-NA-12E';
-
+ product3.CanNotCancelledGurantee__c=true;
insert product3;
PricebookEntry entry = new PricebookEntry( Pricebook2Id=pricebookId, Product2Id=product3.Id);
@@ -1040,6 +1066,7 @@
oppli.PricebookEntryId = entry.Id;
insert oppli;
System.Test.stopTest();
+ StaticParameter.EscapeOppandStaTrigger = false;
//Test.startTest();
// NFM007銈堛倞銆侀�佷俊銇椼仾銇勩亾銇�
//System.assertEquals('', NFM007Controller.debug_msg);
@@ -1059,6 +1086,7 @@
StaticParameter.EscapeNFM001Trigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
+ StaticParameter.EscapeOppandStaTrigger = true;
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
if (rectCo.size() == 0) {
return;
@@ -1111,7 +1139,6 @@
LicenseAndAccount__c = company1.Id
);
insert linc;
- System.Test.startTest();
// 鍐嶅彇寰�
//List<Id> accountIds = new Id[] {company.Id, section.Id, depart.Id};
//List<Account> accList = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id in :accountIds order by Management_Code__c];
@@ -1134,6 +1161,7 @@
opp.Contract_DB_SalesDept_complite_day__c = date.newinstance(2019, 05, 22);
opp.NotesApprovedNo__c = 'Test20180622';
opp.Estimation_Id__c = '';
+ opp.multiYearWarranty__c =true;
insert opp;
Quote quo = new Quote();
@@ -1147,6 +1175,7 @@
quo.OCM_Agent1_Price__c = 203;
quo.Pricebook2Id = pricebookId;
insert quo;
+ System.Test.startTest();
opp.Estimation_Decision__c = true;
opp.Estimation_Id__c = quo.ID;
update opp;
@@ -1166,6 +1195,7 @@
product3.Asset_Model_No__c = '11111';
product3.MDM_Model_No__c = '123';
product3.ProductCode = 'OTV-SP1H-NA-12E';
+ product3.CanNotCancelledGurantee__c=true;
insert product3;
@@ -1210,6 +1240,7 @@
insert oppli;
System.Test.stopTest();
+ StaticParameter.EscapeOppandStaTrigger = false;
//Test.startTest();
// NFM007銈堛倞銆侀�佷俊銇椼仾銇勩亾銇�
//System.assertEquals('', NFM007Controller.debug_msg);
@@ -1226,6 +1257,7 @@
StaticParameter.EscapeNFM001Trigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
+ StaticParameter.EscapeOppandStaTrigger = true;
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
if (rectCo.size() == 0) {
return;
@@ -1278,7 +1310,6 @@
LicenseAndAccount__c = company1.Id
);
insert linc;
- System.Test.startTest();
// 鍐嶅彇寰�
//List<Id> accountIds = new Id[] {company.Id, section.Id, depart.Id};
//List<Account> accList = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id in :accountIds order by Management_Code__c];
@@ -1301,6 +1332,8 @@
opp.Contract_DB_SalesDept_complite_day__c = date.newinstance(2019, 05, 22);
opp.NotesApprovedNo__c = 'Test20180622';
opp.Estimation_Id__c = '';
+ opp.multiYearWarranty__c =true;
+ opp.CurrencyIsoCode = 'USD';
insert opp;
Quote quo = new Quote();
@@ -1314,6 +1347,7 @@
quo.OCM_Agent1_Price__c = 203;
quo.Pricebook2Id = pricebookId;
insert quo;
+ System.Test.startTest();
opp.Estimation_Decision__c = true;
opp.Estimation_Id__c = quo.ID;
update opp;
@@ -1333,6 +1367,7 @@
product3.Asset_Model_No__c = '11111';
product3.MDM_Model_No__c = '123';
product3.ProductCode = 'OTV-SP1H-NA-12E';
+ product3.CanNotCancelledGurantee__c=true;
insert product3;
@@ -1380,6 +1415,7 @@
//Test.startTest();
// NFM007銈堛倞銆侀�佷俊銇椼仾銇勩亾銇�
//System.assertEquals('', NFM007Controller.debug_msg);
+ StaticParameter.EscapeOppandStaTrigger = false;
opp.SAP_Send_OK__c = true;
opp.Gurantee_Period__c = '2';
opp.oldData_flg__c = true;
@@ -1387,4 +1423,9 @@
update opp;
//Test.stopTest();
}
+
+ static testMethod void test_00() {
+ NFM007Controller controller = new NFM007Controller();
+ controller.test();
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1