Lib_Test_Enterprise_MergeTest

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

Defined (1)

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

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