2

i'm getting a bit lost in the weeds with the error I'm getting when trying to deploy this simple test class to production. In the sandbox, it compiles fine and runs fine test-wise, but when it comes time to deploy, I'm getting this specific error on line 22 when instantiating/inserting a new quote: "Constructor not defined: [Quote].< Constructor>()"

@isTest(seeAllData=true)

public class testCreatePayments {

static testMethod void insertPayments() {

    //Create test data
    Account acc = new Account(Name = 'testAcc');  
    insert acc;  

    Opportunity opp = new Opportunity(Name='TestOpp', AccountId = acc.Id, CloseDate = System.Today(), StageName = 'Prospecting');
    insert opp;   

    Product2 prodtest = new Product2(Name = 'Test', IsActive = TRUE, Family = 'Buffet');
    insert prodtest;

    Pricebook2 stdpb = [SELECT Id FROM Pricebook2 WHERE IsStandard = true];

    PricebookEntry pbentrytest = new PricebookEntry(Pricebook2Id = stdpb.Id, Product2Id = prodtest.Id, UnitPrice = 1, IsActive = TRUE, UseStandardPrice = FALSE); 
    insert pbentrytest;    

    Quote qtest = new Quote();
    qtest.Name = 'test';
    qtest.OpportunityId = opp.Id;
    qtest.Pricebook2Id = stdpb.Id;
    insert qtest;

    QuoteLineItem qlineitem = new QuoteLineItem(QuoteId = qtest.Id, Quantity = 1, Product2Id = prodtest.Id, PricebookEntryId = pbentrytest.Id, UnitPrice = 1);
    insert qlineitem;

    Payment__c pmt = new Payment__c(quote_line_item__c = qlineitem.Id);          
    insert pmt;     
}
}

Any ideas would be appreciated. Prior to this, I was receiving an: "Invalid constructor syntax, name=value pairs can only be used for SObjects" error, which I resolved (or thought I resolved) by passing the Quote parameters in separate lines.

The trigger this class is attempting to test is one based off of the LREngine (roll up summaries on look ups). I can post that code if needed.

Thank you in advance!

TimD
  • 35
  • 5

1 Answers1

4

It sounds like you may have an Apex class called Quote in your production org that is "hiding" the Quote SObject. You can check by looking under Setup -> Develop -> Apex Classes in your production org.

If it is there and you want to get rid of it see Deleting Triggers/Classes from Production.

PS A comment was briefly posted to check that Quotes are enabled in your production org. Not sure if its possible to get production and sandbox set differently but worth a quick check.

Keith C
  • 135,775
  • 26
  • 201
  • 437
  • Hey Keith, you were right on the money! Turned out to be another class created by someone else in the system named of all things...Quote sigh. – TimD Oct 24 '14 at 03:24