Lib_Test_Partner_UpsertTest

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

Defined (1)

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

/lib/Force.com-Toolkit-for-PHP/unit_test/Lib/Test/Partner/UpsertTest.php  
  1. class Lib_Test_Partner_UpsertTest extends Lib_Test_TestAbstractPartner 
  2. public function getTestName() 
  3. return 'Upsert'; 
  4.  
  5. /** 
  6. * TODO Implement  
  7. */ 
  8. protected function _run() 
  9. $createFields = array ( 
  10. 'FirstName' => 'George',  
  11. 'LastName' => 'Smith',  
  12. 'Phone' => '510-555-5555',  
  13. 'BirthDate' => '1927-01-25',  
  14. 'Email' => 'test01@test.com' 
  15. ); 
  16.  
  17. $sObject = new SObject(); 
  18. $sObject->fields = $createFields; 
  19. $sObject->type = 'Contact'; 
  20.  
  21. $createResponse = $this->_mySforceConnection->create(array($sObject)); 
  22. echo "Creating New Contact\r\n"; 
  23. print_r($createResponse); 
  24.  
  25. $sObject->fields['FirstName'] = 'Bill'; 
  26. $sObject->fields['LastName'] = 'Clinton'; 
  27. $sObject->fields['Email'] = 'test01@test.com'; 
  28.  
  29. $upsertResponse = $this->_mySforceConnection->upsert('Email', array($sObject)); 
  30. echo "Upserting Contact (existing)\r\n"; 
  31. print_r($upsertResponse); 
  32.  
  33. $sObject->fields['FirstName'] = 'John'; 
  34. $sObject->fields['LastName'] = 'Smith'; 
  35. $sObject->fields['Email'] = 'test02@test.com'; 
  36.  
  37. echo "Upserting Contact (new)\n"; 
  38. $upsertResponse = $this->_mySforceConnection->upsert('Email', array ($sObject)); 
  39. print_r($upsertResponse);