function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sammy7Sammy7 

Test.getStandardPricebookId() broke overnight?

isTest
private class TestInvoicepdfclass {
    static testmethod  void testpdfbutton (){
        
Pricebook2 pb = new Pricebook2(Name = 'Standard Price Book 2009', Description = 'Price Book 2009 Products', IsActive = true );
  insert pb;
Product2 prod = new Product2(Name = 'SLA: Bronze', IsActive = true);
  insert prod;
PricebookEntry pbe=new PricebookEntry(unitprice=0.01,Product2Id=prod.Id, Pricebook2Id=Test.getStandardPricebookId() , IsActive= true); 
  insert pbe;      
           
        Account acc = new Account (name='Acme');
        insert acc;
        Opportunity opp= new Opportunity ();
        Opportunity opp2= new Opportunity ();
        opp.name= 'Testopp';
        Opp.Accountid= acc.id;
        opp.CloseDate= date.today();
        opp.StageName= 'Closed Won';
       opp.Pricebook2id=Test.getStandardPricebookId();
        opp2.name= 'Testopp2';
        Opp2.Accountid= acc.id;
        opp2.CloseDate= date.today();
        opp2.StageName= 'Closed Won';
       opp2.Pricebook2id=Test.getStandardPricebookId();
        insert opp; insert opp2;
            
OpportunityLineItem oppLine = new OpportunityLineItem( pricebookentryid=pbe.Id,TotalPrice=2000, Quantity = 2,Opportunityid = opp.Id);
insert oppLine;       
        
        Quote q= new Quote ();
        	 q.Name= 'Testq';
        	q.OpportunityId= Opp.id;
         	q.quotetoinvoice__C= True;
         	q.REP__C= 'AC' ;
        	q.BillingStreet= '123';
        	q.BillingCity= 'City';
        	q.BillingPostalCode= '12345';
             q.Pricebook2Id= Test.getStandardPricebookId();
           
        
         List<id> oppids= new List<id> ();
        oppids.add(opp.Id); oppids.add(opp2.id);
        
        
InvoicePdfWsSample.generateInvoicePdf(oppids);
       
         } 
}

I dont understand, Im using this in my test class (above) it was working fine yesterday and today, its giving me this error: 
line 9: Method does not exist or incorrect signature: Test.getStandardPricebookId()
Please advice. I'm using the same code in my other test class and it is not prompting any errors.....
Best Answer chosen by Sammy7
Sammy7Sammy7
Nvm, found another test class ... :/