Lib_Test_Partner_CDUTest

Create Delete Undelete Sample.

Defined (1)

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

/lib/Force.com-Toolkit-for-PHP/unit_test/Lib/Test/Partner/CDUTest.php  
  1. class Lib_Test_Partner_CDUTest extends Lib_Test_TestAbstractPartner 
  2. public function getTestName() 
  3. return 'CDU'; 
  4.  
  5. protected function _run() 
  6. $fields = array ( 
  7. 'FirstName' => 'John',  
  8. 'LastName' => 'Smith',  
  9. 'Phone' => '510-555-5555',  
  10. 'BirthDate' => '1950-01-01' 
  11. ); 
  12.  
  13. $sObject = new SObject(); 
  14. $sObject->fields = $fields; 
  15. $sObject->type = 'Contact'; 
  16.  
  17. $sObject2 = new SObject(); 
  18. $sObject2->fields = $fields; 
  19. $sObject2->type = 'Contact'; 
  20.  
  21. $createResponse = $this->_mySforceConnection->create(array($sObject, $sObject2)); 
  22.  
  23. echo "**** Creating the following:\r\n"; 
  24. print_r($createResponse); 
  25.  
  26. $ids = array(); 
  27. foreach ($createResponse as $createResult) { 
  28. print_r($createResult); 
  29. array_push($ids, $createResult->id); 
  30. echo "**** Now for Delete:\r\n"; 
  31. $deleteResult = $this->_mySforceConnection->delete($ids); 
  32. print_r($deleteResult); 
  33.  
  34. echo "**** Now for UnDelete:\r\n"; 
  35. $unDeleteResult = $this->_mySforceConnection->undelete($ids); 
  36. print_r($unDeleteResult);