Lib_Test_Partner_FieldsToNullTest

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

Defined (1)

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

/lib/Force.com-Toolkit-for-PHP/unit_test/Lib/Test/Partner/FieldsToNullTest.php  
  1. class Lib_Test_Partner_FieldsToNullTest extends Lib_Test_TestAbstractPartner 
  2. public function getTestName() 
  3. return 'FieldsToNull'; 
  4.  
  5. protected function _run() 
  6. // //Used for sample fieldsToNull from file fieldsToNull.php 
  7. // $LEADID = '00QA0000001QSQl'; 
  8. // 
  9. // // TODO Create lead 
  10. // $leadid = $LEADID; 
  11. // $query = "select id, title, firstname, lastname from lead where id = '$leadid'"; 
  12. //  
  13. // $queryResponse = $this->_mySforceConnection->query($query); 
  14. // $queryResult = new QueryResult($queryResponse); 
  15. // echo "***** Initial query response *****\n"; 
  16. // print_r($queryResult); 
  17. //  
  18. // $sObject = new SObject(); 
  19. // $sObject->fieldsToNull = array ( 
  20. // "Title", "FirstName" 
  21. // ); 
  22. // $sObject->type = 'Lead'; 
  23. // $sObject->Id = $leadid; 
  24. // $updateResponse = $this->_mySforceConnection->update(array ($sObject)); 
  25. //  
  26. // echo "***** Updated object with fields to null *****\n"; 
  27. // print_r($updateResponse); 
  28. //  
  29. // $queryResponse = $this->_mySforceConnection->query($query); 
  30. // $queryResult = new QueryResult($queryResponse); 
  31. // echo "***** Final query response *****\n"; 
  32. // print_r($queryResult); 
  33. $sObject = new SObject(); 
  34.  
  35. $fields = array( 
  36. 'FirstName' => 'Mary',  
  37. 'LastName' => 'Jane',  
  38. 'Phone' => '510-555-5555' 
  39. ); 
  40.  
  41. $sObject->fields = $fields; 
  42. $sObject->type = 'Contact'; 
  43.  
  44. $createResponse = $this->_mySforceConnection->create(array($sObject)); 
  45.  
  46. $retrieveResult= $this->_mySforceConnection->retrieve("FirstName, LastName, Phone", "Contact", $createResponse->id); 
  47. echo "***** Before fieldsToNull\r\n"; 
  48. print_r($retrieveResult); 
  49.  
  50. $sObject = new SObject(); 
  51. $fields = array( 
  52. 'fieldsToNull' => 'Phone',  
  53. 'Id' => $createResponse->id 
  54. ); 
  55. $sObject->fields = $fields; 
  56. $sObject->type = 'Contact'; 
  57.  
  58. $updateResult = $this->_mySforceConnection->update(array($sObject)); 
  59.  
  60. $queryResult = $this->_mySforceConnection->retrieve("FirstName, LastName, Phone", "Contact", $createResponse->id); 
  61. echo "***** After fieldsToNull\r\n"; 
  62. print_r($queryResult);