Lib_Test_Enterprise_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/Enterprise/CDUTest.php  
  1. class Lib_Test_Enterprise_CDUTest extends Lib_Test_TestAbstractEnterprise 
  2. public function getTestName() 
  3. return 'CDU'; 
  4.  
  5. protected function _run() 
  6. $sObject = new stdclass(); 
  7. $sObject->FirstName = 'Smith'; 
  8. $sObject->LastName = 'John'; 
  9. $sObject->Phone = '510-555-5555'; 
  10. $sObject->BirthDate = '1927-01-25'; 
  11.  
  12. $sObject2 = new stdclass(); 
  13. $sObject2->FirstName = 'Mary'; 
  14. $sObject2->LastName = 'Smith'; 
  15. $sObject2->Phone = '510-486-9969'; 
  16. $sObject2->BirthDate = '1957-01-25'; 
  17.  
  18. echo "**** Creating the following:\r\n"; 
  19. $createResponse = $this->_mySforceConnection->create(array($sObject, $sObject2), 'Contact'); 
  20.  
  21. $ids = array(); 
  22. foreach ($createResponse as $createResult) { 
  23. print_r($createResult); 
  24. array_push($ids, $createResult->id); 
  25. echo "**** Now for Delete:\r\n"; 
  26. $deleteResult = $this->_mySforceConnection->delete($ids); 
  27. print_r($deleteResult); 
  28.  
  29. echo "**** Now for UnDelete:\r\n"; 
  30. $deleteResult = $this->_mySforceConnection->undelete($ids); 
  31. print_r($deleteResult);