Lib_Test_Partner_ConvertLeadTest

The Gravity Forms Salesforce Add-On Lib Test Partner ConvertLeadTest class.

Defined (1)

The class is defined in the following location(s).

/lib/Force.com-Toolkit-for-PHP/unit_test/Lib/Test/Partner/ConvertLeadTest.php  
  1. class Lib_Test_Partner_ConvertLeadTest extends Lib_Test_TestAbstractPartner 
  2. public function getTestName() 
  3. return 'ConvertLead'; 
  4.  
  5. protected function _run() 
  6. // Create lead 
  7. $newLead = new SObject(); 
  8.  
  9. $fields = array( 
  10. 'Company' => 'test company',  
  11. 'FirstName' => 'John',  
  12. 'LastName' => 'Smith' 
  13. ); 
  14.  
  15. $newLead->fields = $fields; 
  16. $newLead->type = 'Lead'; 
  17.  
  18. $createResponse = 
  19. $this->_mySforceConnection->create( 
  20. array($newLead) 
  21. ); 
  22.  
  23. echo "**** Created lead:\r\n"; 
  24. print_r($createResponse); 
  25.  
  26. $leadConvert = new stdClass; 
  27. $leadConvert->convertedStatus='Closed - Converted'; 
  28. $leadConvert->doNotCreateOpportunity='false'; 
  29. // $leadConvert->leadId=$convertLEADID; 
  30. $leadConvert->leadId=$createResponse->id; 
  31. $leadConvert->overwriteLeadSource='true'; 
  32. $leadConvert->sendNotificationEmail='true'; 
  33.  
  34. $leadConvertArray = array($leadConvert); 
  35. $leadConvertResponse = $this->_mySforceConnection->convertLead($leadConvertArray); 
  36.  
  37. print_r($leadConvertResponse);