Lib_Test_Partner_MergeTest

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

Defined (1)

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

/lib/Force.com-Toolkit-for-PHP/unit_test/Lib/Test/Partner/MergeTest.php  
  1. class Lib_Test_Partner_MergeTest extends Lib_Test_TestAbstractPartner 
  2. public function getTestName() 
  3. return 'Merge'; 
  4.  
  5. protected function _run() 
  6. $sObject = new SObject(); 
  7. $sObject->type = 'Contact'; 
  8. $fields = array ( 
  9. 'LastName'=>'Tran',  
  10. 'BirthDate'=> '1927-01-25',  
  11. 'Phone' => '510-555-5555',  
  12. ); 
  13. $sObject->fields = $fields; 
  14.  
  15. $sObject2 = new SObject(); 
  16. $sObject2->type = 'Contact'; 
  17. $fields['LastName'] = 'Smith'; 
  18. $fields['FirstName'] = 'Nick'; 
  19. $sObject2->fields = $fields; 
  20.  
  21. $sObject3 = new SObject(); 
  22. $sObject3->type = 'Contact'; 
  23. $fields['Phone'] = '555-555-5555'; 
  24. $sObject3->fields = $fields; 
  25.  
  26. echo "Create 3 contacts.\n"; 
  27. $createResponse = $this->_mySforceConnection->create(array($sObject, $sObject2, $sObject3), 'Lead'); 
  28.  
  29. print_r($createResponse); 
  30.  
  31. // Merge $sObject2 into $sObject 
  32. $mergeRequest = new stdclass(); 
  33. $sObject->Id = $createResponse[0]->id; 
  34. $mergeRequest->masterRecord = $sObject; 
  35. $mergeRequest->comments = 'My merge comments'; 
  36. $mergeRequest->recordToMergeIds = array($createResponse[1]->id, $createResponse[2]->id); 
  37.  
  38. echo "Merge second and third contacts into the first contact.\n"; 
  39. $mergeResponse = $this->_mySforceConnection->merge($mergeRequest); 
  40.  
  41. print_r($mergeResponse);