Lib_Test_Partner_GetUpdatedTest

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

Defined (1)

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

/lib/Force.com-Toolkit-for-PHP/unit_test/Lib/Test/Partner/GetUpdatedTest.php  
  1. class Lib_Test_Partner_GetUpdatedTest extends Lib_Test_TestAbstractPartner 
  2. public function getTestName() 
  3. return 'GetUpdated'; 
  4.  
  5. protected function _run() 
  6. $obj1 = new SObject(); 
  7. $obj1->type = 'Lead'; 
  8.  
  9. $fields = array ( 
  10. 'Company' => 'XYZ Company',  
  11. 'FirstName' => 'John',  
  12. 'LastName' => 'Smith',  
  13. 'LeadSource' => 'Other',  
  14. 'NumberOfEmployees' => 1,  
  15. 'Status' => 'Open' 
  16. ); 
  17. $obj1->fields = $fields; 
  18. $createResponse = $this->_mySforceConnection->create(array($obj1)); 
  19. echo "***** Creating Lead *****\n"; 
  20. print_r($createResponse); 
  21.  
  22. $obj1->Id = $createResponse->id; 
  23. $obj1->fields['LastName'] = 'Doe'; 
  24.  
  25. $updateResponse = $this->_mySforceConnection->update(array($obj1)); 
  26. echo "***** Updating Lead *****\n"; 
  27. print_r($updateResponse); 
  28.  
  29. echo "***** Wait 60 seconds *****\n"; 
  30. sleep(60); 
  31.  
  32. $currentTime = mktime(); 
  33. // assume that update occured within the last 5 mins. 
  34. $startTime = $currentTime-(60*10); 
  35. $endTime = $currentTime; 
  36.  
  37. echo "***** Get Updated Leads from the last 5 minutes *****\n"; 
  38. $getUpdatedResponse = $this->_mySforceConnection->getUpdated('Lead', $startTime, $endTime); 
  39. print_r($getUpdatedResponse);