QuoteLineItem tempQLI = [SELECT QuoteID FROM QuoteLineItem WHERE Discountable__c='YES' Limit 1];
String quoteId = tempQLI.quoteId;
Quote newtestQuote = [SELECT ID
FROM Quote WHERE ID =:quoteId LIMIT 1];
List <QuoteLineItem> insertTestQuote = new List<QuoteLineItem>();
insertTestQuote.add(tempQLI);
Test.startTest();
ApexPages.StandardSetController stdController = new ApexPages.StandardSetController(insertTestQuote);
system.debug('stdController is: '+stdController);
Controller_Quote_Discount Quote_Discount_Test = new Controller_Quote_Discount(stdController);
I'm creating a test class and I need to test a Quote. I do this by querying a Quotelineitem, grabbing it's QuoteId and then query a Quote with the quotelineitem's QuoteId. I then put the Quote into a list which I pass as an argument using StandardSetController to my Controller class.
However, in my Controller class, it's failing to grab the QuoteID as an argument the way it should. Here's my relevant Controller class code:
public Controller_Quote_Discount(ApexPages.StandardSetController stdSetController)
{
quoteId=ApexPages.currentPage().getParameters().get('id');
system.debug('quoteID in controller is: '+quoteID);
When I check to see what quoteId is in my public Controller class, it returns null. What is causing this behaviour?