| | |
| | | @isTest |
| | | private class OrderPdfControllerTest { |
| | | |
| | | @TestSetup |
| | | static void setup(){ |
| | | TestDataUtility.CreatePIPolicyConfigurations(new string[]{'Opportunity','Contact','Order','Document'}); |
| | | } |
| | | |
| | | |
| | | @isTest static void test_init() { |
| | | List<RecordType> rectDealer = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Dealer']; |
| | | List<RecordType> rectIE = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer IE']; |
| | |
| | | SpecialDeliveryContact2_D__c = contact.Id, |
| | | OpportunityId = opp.Id, |
| | | EffectiveDate = Date.today(), |
| | | ProductListApproveStatus__c = 'Draft',RecordTypeId=rectOdr[0].Id, |
| | | Status = 'Draft', |
| | | Pricebook2Id = pricebook.Id, |
| | | EndUser__c = contact.Id |
| | | EndUser__c = contact.Id, |
| | | EndUserD__c = contact.Id |
| | | ); |
| | | insert order; |
| | | |
| | |
| | | |
| | | insert oiList; |
| | | |
| | | Test.startTest(); |
| | | PageReference page = new PageReference('/apex/OrderContract?id=' + order.Id); |
| | | System.Test.setCurrentPage(page); |
| | | OrderPdfController controller = new OrderPdfController(); |
| | |
| | | controller.saveBtn(); |
| | | |
| | | controller.printBtn(); |
| | | Test.stopTest(); |
| | | } |
| | | |
| | | @isTest static void test_init2() { |
| | |
| | | SpecialDeliveryContact2_D__c = contact.Id, |
| | | OpportunityId = opp.Id, |
| | | EffectiveDate = Date.today(), |
| | | ProductListApproveStatus__c = 'Draft',RecordTypeId=rectOdr[0].Id, |
| | | Status = 'Draft', |
| | | Pricebook2Id = pricebook.Id, |
| | | EndUser__c = contact.Id |
| | | EndUser__c = contact.Id, |
| | | EndUserD__c = contact.Id |
| | | ); |
| | | insert order; |
| | | |
| | |
| | | |
| | | insert oiList; |
| | | |
| | | Test.startTest(); |
| | | PageReference page = new PageReference('/apex/OrderPdf?id=' + order.Id); |
| | | System.Test.setCurrentPage(page); |
| | | OrderPdfController controller = new OrderPdfController(); |
| | |
| | | //controller.init(); |
| | | controller.init2(); |
| | | //controller.init(); |
| | | Test.stopTest(); |
| | | } |
| | | |
| | | @isTest static void test_init2_2() { |
| | |
| | | SpecialDeliveryContact2_D__c = contact.Id, |
| | | OpportunityId = opp.Id, |
| | | EffectiveDate = Date.today(), |
| | | ProductListApproveStatus__c = 'Draft',RecordTypeId=rectOdr[0].Id, |
| | | Status = 'Draft', |
| | | Pricebook2Id = pricebook.Id, |
| | | EndUser__c = contact.Id |
| | | EndUser__c = contact.Id, |
| | | EndUserD__c = contact.Id |
| | | ); |
| | | insert order; |
| | | |
| | |
| | | } |
| | | |
| | | insert oiList; |
| | | |
| | | Test.startTest(); |
| | | PageReference page = new PageReference('/apex/OrderPdf?id=' + order.Id); |
| | | System.Test.setCurrentPage(page); |
| | | OrderPdfController controller = new OrderPdfController(); |
| | | |
| | | controller.init2(); |
| | | Test.stopTest(); |
| | | } |
| | | @isTest static void test_init2_3() { |
| | | List<RecordType> rectDealer = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Dealer']; |
| | |
| | | SpecialDeliveryContact2_D__c = contact.Id, |
| | | OpportunityId = opp.Id, |
| | | EffectiveDate = Date.today(), |
| | | ProductListApproveStatus__c = 'Draft',RecordTypeId=rectOdr[0].Id, |
| | | Status = 'Draft', |
| | | Pricebook2Id = pricebook.Id, |
| | | EndUser__c = contact.Id |
| | | EndUser__c = contact.Id, |
| | | EndUserD__c = contact.Id |
| | | ); |
| | | insert order; |
| | | |
| | |
| | | |
| | | insert oiList; |
| | | |
| | | Test.startTest(); |
| | | PageReference page = new PageReference('/apex/OrderContract?id=' + order.Id); |
| | | System.Test.setCurrentPage(page); |
| | | OrderPdfController controller = new OrderPdfController(); |
| | |
| | | controller.saveBtn(); |
| | | |
| | | controller.printBtn(); |
| | | Test.stopTest(); |
| | | } |
| | | |
| | | } |