• lmeuwly
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

I friends, i'm very new to apex, somehow i managed to create a apex class to attach our custom quote (after some research on developer forum). But i'm unable to create a apex test class. I would very much appreciate if anyone could be able to help me out on this. 

Thank you very much
public class quoteExt {
    ApexPages.StandardController controller;
    public Quote q {get;set;}
    
    public quoteExt(ApexPages.StandardController controller) 
    {   
    controller = controller;
    q = (Quote) controller.getRecord();
    
     }
    
    public quoteExt(){}
    
    public PageReference attactQuote()
    {
    PageReference pdfPage = Page.quotationPDF;
    Blob pdfBlob = pdfPage.getContent();
    QuoteDocument a = new QuoteDocument (quoteid=q.id, Document=pdfBlob);
    insert a;
    
      PageReference detailPage = new PageReference('/../'+ q.id);
       detailPage.setRedirect(true);
       return detailPage;
    }
    static testmethod void basicAttachTest() {
        
         /* Construct the standard controller for quote. */
        ApexPages.StandardController con = new ApexPages.StandardController(new Quote());
        quoteExt ext = new quoteExt(con);
             
    
    }
}