| | |
| | | @isTest |
| | | private class LeadIntentionControllerTest { |
| | | |
| | | @testSetup |
| | | static void setUp(){ |
| | | TestDataUtility.CreatePIPolicyConfigurations( new string[]{'Inquiry_form__c'}); |
| | | } |
| | | |
| | | static testMethod void testMethod1() { |
| | | //医院 |
| | | List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP']; |
| | | LeadIntentionController.forTest(); |
| | | //医院 |
| | | List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP']; |
| | | if (rectHp.size() == 0) { |
| | | return; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin]; |
| | | 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; |
| | | |
| | | |
| | | |
| | | Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id); |
| | | 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; |
| | |
| | | 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 ='未跟进'; |
| | | inquiryform.Status__c ='01.未跟进'; |
| | | inquiryform.Company__c ='北京某某某测试公司'; |
| | | inquiryform.Family_Name__c ='靳'; |
| | | inquiryform.Opportunity_Division__c = '询价'; |
| | | inquiryform.Contact_Name__c = contact2.Id; |
| | | inquiryform.Reasons_options__c ='客户不存在'; |
| | | inquiryform.Reasons_options__c ='已经有询价'; |
| | | inquiryform.Phone__c = '13844756322'; |
| | | inquiryform.Product1__c = '超声'; |
| | | inquiryform.Request1__c = '需要报价'; |
| | | insert inquiryform; |
| | | |
| | | PageReference page = new PageReference('/apex/LeadIntention'); |
| | | page.setRedirect(true); |
| | | System.Test.setCurrentPage(page); |
| | | page.setRedirect(true); |
| | | System.Test.setCurrentPage(page); |
| | | |
| | | |
| | | // LeadIntentionController conTest = new LeadIntentionController(new ApexPages.StandardController(dpt)); |
| | | LeadIntentionController conTest = new LeadIntentionController(); |
| | | System.Test.startTest(); |
| | | conTest.inquiryformId = inquiryform.Id; |
| | | |
| | | // LeadIntentionController conTest = new LeadIntentionController(new ApexPages.StandardController(dpt)); |
| | | LeadIntentionController conTest = new LeadIntentionController(); |
| | | System.Test.startTest(); |
| | | conTest.inquiryformId = inquiryform.Id; |
| | | |
| | | conTest.init(); |
| | | conTest.init(); |
| | | |
| | | conTest.searchOpp(); |
| | | conTest.sortTable(); |
| | | conTest.save(); |
| | | conTest.cancel(); |
| | | conTest.searchOpp(); |
| | | conTest.sortTable(); |
| | | conTest.save(); |
| | | conTest.cancel(); |
| | | |
| | | // conTest.pclInfos.reasonFlg ='1'; |
| | | conTest.saveInquiryOpts(); |
| | | conTest.saveInquiryOpts(); |
| | | |
| | | } |
| | | //测试 选择一些筛选条件 |
| | | static testMethod void testMethod2() { |
| | | //医院 |
| | | //医院 |
| | | List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP']; |
| | | if (rectHp.size() == 0) { |
| | | return; |
| | |
| | | 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 ='未跟进'; |
| | | inquiryform.Status__c ='01.未跟进'; |
| | | inquiryform.Company__c ='北京某某某测试公司'; |
| | | inquiryform.Family_Name__c ='靳'; |
| | | inquiryform.Opportunity_Division__c = '询价'; |
| | | inquiryform.Contact_Name__c = contact2.Id; |
| | | inquiryform.Reasons_options__c ='客户不存在'; |
| | | inquiryform.Reasons_options__c ='已经有询价'; |
| | | inquiryform.Phone__c = '13844756322'; |
| | | inquiryform.Product1__c = '超声'; |
| | | inquiryform.Request1__c = '需要报价'; |