| Total Complexity | 2 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 2 | class Lib_Test_Partner_GetDeletedTest extends Lib_Test_TestAbstractPartner |
||
| 3 | { |
||
| 4 | public function getTestName() |
||
| 5 | { |
||
| 6 | return 'GetDeleted'; |
||
| 7 | } |
||
| 8 | |||
| 9 | protected function _run() |
||
| 10 | { |
||
| 11 | $obj1->type = 'Lead'; |
||
| 12 | |||
| 13 | $fields = array ( |
||
| 14 | 'Company' => 'XYZ Company', |
||
| 15 | 'FirstName' => 'John', |
||
| 16 | 'LastName' => 'Smith', |
||
| 17 | 'LeadSource' => 'Other', |
||
| 18 | 'NumberOfEmployees' => 1, |
||
| 19 | 'Status' => 'Open' |
||
| 20 | ); |
||
| 21 | $obj1->fields = $fields; |
||
| 22 | $createResponse = $this->_mySforceConnection->create(array ($obj1)); |
||
| 23 | |||
| 24 | echo "***** Creating Lead *****\n"; |
||
| 25 | print_r($createResponse); |
||
| 26 | |||
| 27 | $id = $createResponse->id; |
||
| 28 | $deleteResponse = $this->_mySforceConnection->delete(array ($id)); |
||
| 29 | echo "***** Deleting Lead *****\n"; |
||
| 30 | print_r($deleteResponse); |
||
| 31 | |||
| 32 | echo "***** Wait 60 seconds *****\n"; |
||
| 33 | sleep(60); |
||
| 34 | |||
| 35 | $currentTime = mktime(); |
||
| 36 | // assume that delete occured within the last 5 mins. |
||
| 37 | $startTime = $currentTime - (60*10); |
||
| 38 | $endTime = $currentTime; |
||
| 39 | |||
| 40 | echo "***** Get Deleted Leads *****\n"; |
||
| 41 | $getDeletedResponse = $this->_mySforceConnection->getDeleted('Lead', $startTime, $endTime); |
||
| 42 | print_r($getDeletedResponse); |
||
| 43 | } |
||
| 44 | } |