Lib_Test_Partner_MetaDataCreateTest

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

Defined (1)

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

/lib/Force.com-Toolkit-for-PHP/unit_test/Lib/Test/Partner/MetaDataCreateTest.php  
  1. class Lib_Test_Partner_MetaDataCreateTest extends Lib_Test_TestAbstractPartner 
  2. public function getTestName() 
  3. return 'MetaDataCreate'; 
  4.  
  5. protected function _run() 
  6. $myMetadataConnection = new SforceMetadataClient($this->_getMetaDataWSDL(), $this->_mylogin, $this->_mySforceConnection); 
  7.  
  8. $customObject = new SforceCustomObject(); 
  9. $customObject->fullName = 'CustomObjFromPHP__c'; 
  10. $customObject->deploymentStatus = DEPLOYMENT_STATUS_DEPLOYED; 
  11.  
  12. $customObject->setDescription("A description"); 
  13. $customObject->setEnableActivities(true); 
  14. $customObject->setEnableDivisions(false); 
  15. $customObject->setEnableHistory(true); 
  16. $customObject->setEnableReports(true); 
  17. $customObject->setHousehold(false); 
  18. $customObject->setLabel("My Custom Obj from PHP"); 
  19. $customField = new SforceCustomField(); 
  20. $customField->setFullName('MyCustomFieldb__c'); 
  21. $customField->setDescription('Description of New Field'); 
  22. $customField->setLabel('My Custom Field Label'); 
  23. $customField->setType('Text'); 
  24.  
  25. $customObject->nameField = $customField; 
  26.  
  27. $customObject->pluralLabel = 'My Custom Objs from PHP'; 
  28. $customObject->sharingModel = SHARING_MODEL_READWRITE; 
  29.  
  30. print_r($myMetadataConnection->create($customObject)); 
  31.  
  32. /** 
  33. * @param string $rs 
  34. * @return void 
  35. * @throws Lib_Exception_InvalidResponse 
  36. */ 
  37. protected function _validate($rs) 
  38. if(strpos($rs, 'Error') !== FALSE) { 
  39. throw new Lib_Exception_InvalidResponse();