@@ -47,266 +47,266 @@ discard block |
||
47 | 47 | protected $theId = null; |
48 | 48 | |
49 | 49 | public function deleteAll($queryResult) { |
50 | - $records = $queryResult->records; |
|
51 | - $ids = array (); |
|
52 | - $buckets = array_chunk($records, 200); |
|
53 | - foreach ($buckets as $bucket) { |
|
54 | - $ids = array (); |
|
55 | - foreach ($bucket as $record) { |
|
56 | - $sObject = new SObject($record); |
|
57 | - //var_dump($sObject); |
|
58 | - $ids[] = $sObject->Id; |
|
59 | - } |
|
60 | - try { |
|
61 | - global $mySforceConnection; |
|
62 | - $this->mySforceConnection->delete($ids); |
|
63 | - } catch (Exception $e) { |
|
64 | - print_r($e->faultstring); |
|
65 | - } |
|
66 | - } |
|
67 | - |
|
68 | - $queryLocator = $queryResult->queryLocator; |
|
69 | - if (isset($queryLocator)) { |
|
70 | - $result = $this->mySforceConnection->queryMore($queryLocator); |
|
71 | - $this->deleteAll($result); |
|
72 | - } |
|
50 | + $records = $queryResult->records; |
|
51 | + $ids = array (); |
|
52 | + $buckets = array_chunk($records, 200); |
|
53 | + foreach ($buckets as $bucket) { |
|
54 | + $ids = array (); |
|
55 | + foreach ($bucket as $record) { |
|
56 | + $sObject = new SObject($record); |
|
57 | + //var_dump($sObject); |
|
58 | + $ids[] = $sObject->Id; |
|
59 | + } |
|
60 | + try { |
|
61 | + global $mySforceConnection; |
|
62 | + $this->mySforceConnection->delete($ids); |
|
63 | + } catch (Exception $e) { |
|
64 | + print_r($e->faultstring); |
|
65 | + } |
|
66 | + } |
|
67 | + |
|
68 | + $queryLocator = $queryResult->queryLocator; |
|
69 | + if (isset($queryLocator)) { |
|
70 | + $result = $this->mySforceConnection->queryMore($queryLocator); |
|
71 | + $this->deleteAll($result); |
|
72 | + } |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | protected function setUp() { |
76 | - echo "Begin Test Setup\r\n"; |
|
77 | - try { |
|
78 | - // Create the fixtures. |
|
79 | - $this->mySforceConnection = new SforcePartnerClient(); |
|
80 | - $this->mySforceConnection->createConnection($this->wsdl); |
|
81 | - $this->mylogin = $this->mySforceConnection->login($this->username, $this->password); |
|
82 | - |
|
83 | - // CLEAN |
|
84 | - $queryOptions = new QueryOptions(300); |
|
85 | - $createQuery = 'SELECT Id from Contact where FirstName = \'DELETE_ME\''; |
|
86 | - $leadQuery = 'SELECT Id from Lead where FirstName = \'DELETE_ME\''; |
|
87 | - $createQueryResult = $this->mySforceConnection->query($createQuery, $queryOptions); |
|
88 | - $leadQueryResult = $this->mySforceConnection->query($leadQuery, $queryOptions); |
|
89 | - if ($createQueryResult->size > 0) { |
|
90 | - echo 'Deleting '.$createQueryResult->size." contacts.\r\n"; |
|
91 | - $this->deleteAll($createQueryResult); |
|
92 | - } |
|
93 | - if ($leadQueryResult->size > 0) { |
|
94 | - $this->deleteAll($leadQueryResult); |
|
95 | - } |
|
96 | - $createFields = array ( |
|
97 | - 'FirstName' => 'DELETE_ME', |
|
98 | - 'LastName' => 'DELETE_ME', |
|
99 | - 'MailingCity' => 'San Diego', |
|
100 | - 'MailingState' => 'CA' |
|
101 | - ); |
|
102 | - $sObject1 = new SObject(); |
|
103 | - $sObject1->fields = $createFields; |
|
104 | - $sObject1->type = 'Contact'; |
|
105 | - $createResponse = $this->mySforceConnection->create(array($sObject1)); |
|
106 | - $this->assertNotNull($createResponse); |
|
107 | - $this->assertTrue($createResponse->success); |
|
108 | - } catch (SoapFault $fault) { |
|
109 | - $this->fail($fault->faultstring); |
|
110 | - } |
|
111 | - $this->theId = $createResponse->id; |
|
112 | - echo "Test setup complete.\r\n"; |
|
76 | + echo "Begin Test Setup\r\n"; |
|
77 | + try { |
|
78 | + // Create the fixtures. |
|
79 | + $this->mySforceConnection = new SforcePartnerClient(); |
|
80 | + $this->mySforceConnection->createConnection($this->wsdl); |
|
81 | + $this->mylogin = $this->mySforceConnection->login($this->username, $this->password); |
|
82 | + |
|
83 | + // CLEAN |
|
84 | + $queryOptions = new QueryOptions(300); |
|
85 | + $createQuery = 'SELECT Id from Contact where FirstName = \'DELETE_ME\''; |
|
86 | + $leadQuery = 'SELECT Id from Lead where FirstName = \'DELETE_ME\''; |
|
87 | + $createQueryResult = $this->mySforceConnection->query($createQuery, $queryOptions); |
|
88 | + $leadQueryResult = $this->mySforceConnection->query($leadQuery, $queryOptions); |
|
89 | + if ($createQueryResult->size > 0) { |
|
90 | + echo 'Deleting '.$createQueryResult->size." contacts.\r\n"; |
|
91 | + $this->deleteAll($createQueryResult); |
|
92 | + } |
|
93 | + if ($leadQueryResult->size > 0) { |
|
94 | + $this->deleteAll($leadQueryResult); |
|
95 | + } |
|
96 | + $createFields = array ( |
|
97 | + 'FirstName' => 'DELETE_ME', |
|
98 | + 'LastName' => 'DELETE_ME', |
|
99 | + 'MailingCity' => 'San Diego', |
|
100 | + 'MailingState' => 'CA' |
|
101 | + ); |
|
102 | + $sObject1 = new SObject(); |
|
103 | + $sObject1->fields = $createFields; |
|
104 | + $sObject1->type = 'Contact'; |
|
105 | + $createResponse = $this->mySforceConnection->create(array($sObject1)); |
|
106 | + $this->assertNotNull($createResponse); |
|
107 | + $this->assertTrue($createResponse->success); |
|
108 | + } catch (SoapFault $fault) { |
|
109 | + $this->fail($fault->faultstring); |
|
110 | + } |
|
111 | + $this->theId = $createResponse->id; |
|
112 | + echo "Test setup complete.\r\n"; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | public function testLogin() { |
116 | - echo "testLogin\r\n"; |
|
117 | - try { |
|
118 | - $mylogin = $this->mylogin; |
|
119 | - $this->assertNotNull($mylogin); |
|
120 | - $this->assertNotNull($mylogin->userInfo); |
|
121 | - } catch (SoapFault $fault) { |
|
122 | - $this->fail($fault->faultstring); |
|
123 | - } |
|
116 | + echo "testLogin\r\n"; |
|
117 | + try { |
|
118 | + $mylogin = $this->mylogin; |
|
119 | + $this->assertNotNull($mylogin); |
|
120 | + $this->assertNotNull($mylogin->userInfo); |
|
121 | + } catch (SoapFault $fault) { |
|
122 | + $this->fail($fault->faultstring); |
|
123 | + } |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | public function testServerTimestamp() { |
127 | - echo "testServerTimestamp\r\n"; |
|
128 | - try { |
|
129 | - $timeStamp = $this->mySforceConnection->getServerTimestamp(); |
|
130 | - $this->assertNotNull($timeStamp); |
|
131 | - $this->assertNotNull($timeStamp->timestamp); |
|
132 | - } catch (SoapFault $fault) { |
|
133 | - $this->fail($fault->faultstring); |
|
134 | - } |
|
127 | + echo "testServerTimestamp\r\n"; |
|
128 | + try { |
|
129 | + $timeStamp = $this->mySforceConnection->getServerTimestamp(); |
|
130 | + $this->assertNotNull($timeStamp); |
|
131 | + $this->assertNotNull($timeStamp->timestamp); |
|
132 | + } catch (SoapFault $fault) { |
|
133 | + $this->fail($fault->faultstring); |
|
134 | + } |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | public function testUserInfo() { |
138 | - echo "testUserInfo\r\n"; |
|
139 | - try { |
|
140 | - $userInfo = $this->mySforceConnection->getUserInfo(); |
|
141 | - $this->assertNotNull($userInfo); |
|
142 | - $this->assertNotNull($userInfo->userId); |
|
143 | - $this->assertNotNull($userInfo->userFullName); |
|
144 | - } catch (SoapFault $fault) { |
|
145 | - $this->fail($fault->faultstring); |
|
146 | - } |
|
138 | + echo "testUserInfo\r\n"; |
|
139 | + try { |
|
140 | + $userInfo = $this->mySforceConnection->getUserInfo(); |
|
141 | + $this->assertNotNull($userInfo); |
|
142 | + $this->assertNotNull($userInfo->userId); |
|
143 | + $this->assertNotNull($userInfo->userFullName); |
|
144 | + } catch (SoapFault $fault) { |
|
145 | + $this->fail($fault->faultstring); |
|
146 | + } |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | public function testDescribeSObject() { |
150 | - echo "testDescribeSObject\r\n"; |
|
151 | - try { |
|
152 | - $response = $this->mySforceConnection->describeSObject('Contact'); |
|
153 | - $this->assertNotNull($response); |
|
154 | - $this->assertEquals('Contact', $response->name); |
|
155 | - } catch (SoapFault $fault) { |
|
156 | - echo $fault; |
|
157 | - $this->fail($fault->faultstring); |
|
158 | - } |
|
150 | + echo "testDescribeSObject\r\n"; |
|
151 | + try { |
|
152 | + $response = $this->mySforceConnection->describeSObject('Contact'); |
|
153 | + $this->assertNotNull($response); |
|
154 | + $this->assertEquals('Contact', $response->name); |
|
155 | + } catch (SoapFault $fault) { |
|
156 | + echo $fault; |
|
157 | + $this->fail($fault->faultstring); |
|
158 | + } |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | public function testDescribeSObjects() { |
162 | - echo "testDescribeSObjects\r\n"; |
|
163 | - try { |
|
164 | - $response = $this->mySforceConnection->describeSObjects(array ( |
|
165 | - 'Account', |
|
166 | - 'Contact' |
|
167 | - )); |
|
168 | - $this->assertNotNull($response); |
|
169 | - $this->assertEquals(2, sizeof($response)); |
|
170 | - } catch (SoapFault $fault) { |
|
171 | - $this->fail($fault->faultstring); |
|
172 | - } |
|
162 | + echo "testDescribeSObjects\r\n"; |
|
163 | + try { |
|
164 | + $response = $this->mySforceConnection->describeSObjects(array ( |
|
165 | + 'Account', |
|
166 | + 'Contact' |
|
167 | + )); |
|
168 | + $this->assertNotNull($response); |
|
169 | + $this->assertEquals(2, sizeof($response)); |
|
170 | + } catch (SoapFault $fault) { |
|
171 | + $this->fail($fault->faultstring); |
|
172 | + } |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | public function testDescribeGlobal() { |
176 | - echo "testDescribeGlobal\r\n"; |
|
177 | - try { |
|
178 | - $response = $this->mySforceConnection->describeGlobal(); |
|
179 | - $this->assertNotNull($response); |
|
180 | - $this->assertNotNull($response->types); |
|
181 | - } catch (SoapFault $fault) { |
|
182 | - $this->fail($fault->faultstring); |
|
183 | - } |
|
176 | + echo "testDescribeGlobal\r\n"; |
|
177 | + try { |
|
178 | + $response = $this->mySforceConnection->describeGlobal(); |
|
179 | + $this->assertNotNull($response); |
|
180 | + $this->assertNotNull($response->types); |
|
181 | + } catch (SoapFault $fault) { |
|
182 | + $this->fail($fault->faultstring); |
|
183 | + } |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | public function testDescribeLayout() { |
187 | - echo "testDescribeLayout\r\n"; |
|
188 | - try { |
|
189 | - $response = $this->mySforceConnection->describeLayout('Contact'); |
|
190 | - $this->assertNotNull($response); |
|
191 | - $this->assertNotNull($response->recordTypeMappings); |
|
192 | - } catch (SoapFault $fault) { |
|
193 | - $this->fail($fault->faultstring); |
|
194 | - } |
|
187 | + echo "testDescribeLayout\r\n"; |
|
188 | + try { |
|
189 | + $response = $this->mySforceConnection->describeLayout('Contact'); |
|
190 | + $this->assertNotNull($response); |
|
191 | + $this->assertNotNull($response->recordTypeMappings); |
|
192 | + } catch (SoapFault $fault) { |
|
193 | + $this->fail($fault->faultstring); |
|
194 | + } |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | public function testDescribeTabs() { |
198 | - echo "testDescribeTabs\r\n"; |
|
199 | - try { |
|
200 | - $response = $this->mySforceConnection->describeTabs(); |
|
201 | - $this->assertNotNull($response); |
|
202 | - $this->assertTrue(sizeof($response) > 0); |
|
203 | - } catch (SoapFault $fault) { |
|
204 | - $this->fail($fault->faultstring); |
|
205 | - } |
|
198 | + echo "testDescribeTabs\r\n"; |
|
199 | + try { |
|
200 | + $response = $this->mySforceConnection->describeTabs(); |
|
201 | + $this->assertNotNull($response); |
|
202 | + $this->assertTrue(sizeof($response) > 0); |
|
203 | + } catch (SoapFault $fault) { |
|
204 | + $this->fail($fault->faultstring); |
|
205 | + } |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | public function testCreate() { |
209 | - // now done in setUp so that theId can be accessed by other tests. |
|
209 | + // now done in setUp so that theId can be accessed by other tests. |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | public function testRetrieve() { |
213 | - echo "testRetrieve\r\n"; |
|
214 | - try { |
|
215 | - $ids = array ($this->theId); |
|
216 | - $this->assertEquals(1, count($ids)); |
|
217 | - |
|
218 | - $retrieveFields = 'LastName'; |
|
219 | - $retrieveResponse = $this->mySforceConnection->retrieve($retrieveFields, 'Contact', $ids); |
|
220 | - $sObject = new SObject($retrieveResponse); |
|
221 | - $this->assertEquals($this->theId, $sObject->Id); |
|
222 | - // Fields on SObjects are SimpleXMLElements. |
|
223 | - //$this->assertEquals('DELETE_ME', $sObject->fields->LastName); |
|
224 | - //$this->assertEquals('San Diego', $sObject->MailingCity); |
|
225 | - //$this->assertEquals('CA', $sObject->MailingState); |
|
226 | - } catch (SoapFault $fault) { |
|
227 | - $this->fail($fault->faultstring); |
|
228 | - } |
|
213 | + echo "testRetrieve\r\n"; |
|
214 | + try { |
|
215 | + $ids = array ($this->theId); |
|
216 | + $this->assertEquals(1, count($ids)); |
|
217 | + |
|
218 | + $retrieveFields = 'LastName'; |
|
219 | + $retrieveResponse = $this->mySforceConnection->retrieve($retrieveFields, 'Contact', $ids); |
|
220 | + $sObject = new SObject($retrieveResponse); |
|
221 | + $this->assertEquals($this->theId, $sObject->Id); |
|
222 | + // Fields on SObjects are SimpleXMLElements. |
|
223 | + //$this->assertEquals('DELETE_ME', $sObject->fields->LastName); |
|
224 | + //$this->assertEquals('San Diego', $sObject->MailingCity); |
|
225 | + //$this->assertEquals('CA', $sObject->MailingState); |
|
226 | + } catch (SoapFault $fault) { |
|
227 | + $this->fail($fault->faultstring); |
|
228 | + } |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | public function testUpdate() { |
232 | - echo "testUpdate\r\n"; |
|
233 | - try { |
|
234 | - $id = $this->theId; |
|
235 | - $this->assertNotNull($id); |
|
236 | - $updateFields = array ( |
|
237 | - 'Id' => $id, |
|
238 | - 'MailingCity' => 'New York', |
|
239 | - 'MailingState' => 'NY' |
|
240 | - ); |
|
241 | - $sObject1 = new SObject(); |
|
242 | - $sObject1->fields = $updateFields; |
|
243 | - $sObject1->type = 'Contact'; |
|
244 | - $updateResponse = $this->mySforceConnection->update(array ($sObject1)); |
|
245 | - $this->assertNotNull($updateResponse); |
|
246 | - $this->assertTrue($updateResponse->success); |
|
247 | - } catch (SoapFault $fault) { |
|
248 | - $this->fail($fault->faultstring); |
|
249 | - } |
|
232 | + echo "testUpdate\r\n"; |
|
233 | + try { |
|
234 | + $id = $this->theId; |
|
235 | + $this->assertNotNull($id); |
|
236 | + $updateFields = array ( |
|
237 | + 'Id' => $id, |
|
238 | + 'MailingCity' => 'New York', |
|
239 | + 'MailingState' => 'NY' |
|
240 | + ); |
|
241 | + $sObject1 = new SObject(); |
|
242 | + $sObject1->fields = $updateFields; |
|
243 | + $sObject1->type = 'Contact'; |
|
244 | + $updateResponse = $this->mySforceConnection->update(array ($sObject1)); |
|
245 | + $this->assertNotNull($updateResponse); |
|
246 | + $this->assertTrue($updateResponse->success); |
|
247 | + } catch (SoapFault $fault) { |
|
248 | + $this->fail($fault->faultstring); |
|
249 | + } |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | public function testGetUpdated() { |
253 | - echo "testGetUpdated\r\n"; |
|
254 | - try { |
|
255 | - $type = 'Contact'; |
|
256 | - $currentTime = mktime(); |
|
257 | - // assume that create or update occured within the last 5 mins. |
|
258 | - $startTime = $currentTime-(60*5); |
|
259 | - $endTime = $currentTime; |
|
260 | - $response = $this->mySforceConnection->getUpdated($type, $startTime, $endTime); |
|
261 | - $this->assertNotNull($response); |
|
262 | - |
|
263 | - } catch (SoapFault $fault) { |
|
264 | - $this->fail($fault->faultstring); |
|
265 | - } |
|
253 | + echo "testGetUpdated\r\n"; |
|
254 | + try { |
|
255 | + $type = 'Contact'; |
|
256 | + $currentTime = mktime(); |
|
257 | + // assume that create or update occured within the last 5 mins. |
|
258 | + $startTime = $currentTime-(60*5); |
|
259 | + $endTime = $currentTime; |
|
260 | + $response = $this->mySforceConnection->getUpdated($type, $startTime, $endTime); |
|
261 | + $this->assertNotNull($response); |
|
262 | + |
|
263 | + } catch (SoapFault $fault) { |
|
264 | + $this->fail($fault->faultstring); |
|
265 | + } |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | public function testDelete() { |
269 | - echo "testDelete\r\n"; |
|
270 | - try { |
|
271 | - $ids = array ($this->theId); |
|
272 | - $this->assertEquals(1, count($ids)); |
|
273 | - $response = $this->mySforceConnection->delete($ids); |
|
274 | - $this->assertNotNull($response); |
|
275 | - $this->assertTrue($response->success); |
|
276 | - } catch (SoapFault $fault) { |
|
277 | - $this->fail($fault->faultstring); |
|
278 | - } |
|
269 | + echo "testDelete\r\n"; |
|
270 | + try { |
|
271 | + $ids = array ($this->theId); |
|
272 | + $this->assertEquals(1, count($ids)); |
|
273 | + $response = $this->mySforceConnection->delete($ids); |
|
274 | + $this->assertNotNull($response); |
|
275 | + $this->assertTrue($response->success); |
|
276 | + } catch (SoapFault $fault) { |
|
277 | + $this->fail($fault->faultstring); |
|
278 | + } |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | public function testGetDeleted() { |
282 | - echo "testGetDeleted\r\n"; |
|
283 | - try { |
|
284 | - $type = 'Contact'; |
|
285 | - $currentTime = mktime(); |
|
286 | - // assume that delete occured within the last 5 mins. |
|
287 | - $startTime = $currentTime-(60*10); |
|
288 | - $endTime = $currentTime; |
|
289 | - $response = $this->mySforceConnection->getDeleted($type, $startTime, $endTime); |
|
290 | - if (isset($response)) { |
|
291 | - $this->assertNotNull(count($response->deletedRecords)); |
|
292 | - echo'deleted records = '.count($response->deletedRecords)."\r\n"; |
|
293 | - } |
|
294 | - } catch (SoapFault $fault) { |
|
295 | - $this->fail($fault->faultstring); |
|
296 | - } |
|
282 | + echo "testGetDeleted\r\n"; |
|
283 | + try { |
|
284 | + $type = 'Contact'; |
|
285 | + $currentTime = mktime(); |
|
286 | + // assume that delete occured within the last 5 mins. |
|
287 | + $startTime = $currentTime-(60*10); |
|
288 | + $endTime = $currentTime; |
|
289 | + $response = $this->mySforceConnection->getDeleted($type, $startTime, $endTime); |
|
290 | + if (isset($response)) { |
|
291 | + $this->assertNotNull(count($response->deletedRecords)); |
|
292 | + echo'deleted records = '.count($response->deletedRecords)."\r\n"; |
|
293 | + } |
|
294 | + } catch (SoapFault $fault) { |
|
295 | + $this->fail($fault->faultstring); |
|
296 | + } |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | public function testQuery() { |
300 | - echo "testQuery\r\n"; |
|
301 | - $query = 'SELECT Id,Name,BillingCity,BillingState,Phone,Fax from Account'; |
|
302 | - $queryOptions = new QueryOptions(200); |
|
303 | - try { |
|
304 | - $response = $this->mySforceConnection->query($query, $queryOptions); |
|
305 | - $this->assertNotNull($response); |
|
306 | - $this->assertTrue(sizeof($response) > 0); |
|
307 | - } catch (SoapFault $fault) { |
|
308 | - $this->fail($fault->faultstring); |
|
309 | - } |
|
300 | + echo "testQuery\r\n"; |
|
301 | + $query = 'SELECT Id,Name,BillingCity,BillingState,Phone,Fax from Account'; |
|
302 | + $queryOptions = new QueryOptions(200); |
|
303 | + try { |
|
304 | + $response = $this->mySforceConnection->query($query, $queryOptions); |
|
305 | + $this->assertNotNull($response); |
|
306 | + $this->assertTrue(sizeof($response) > 0); |
|
307 | + } catch (SoapFault $fault) { |
|
308 | + $this->fail($fault->faultstring); |
|
309 | + } |
|
310 | 310 | } |
311 | 311 | /* |
312 | 312 | public function testQueryMore() { |
@@ -346,180 +346,180 @@ discard block |
||
346 | 346 | */ |
347 | 347 | |
348 | 348 | public function testUpsert() { |
349 | - // Make the language field an external id field on the contact |
|
350 | - // table before proceeding. |
|
351 | - echo "testUpsert\r\n"; |
|
352 | - $createFields = array ( |
|
353 | - 'FirstName' => 'DELETE_ME', |
|
354 | - 'LastName' => 'DELETE_ME', |
|
355 | - 'MailingCity' => 'TEST_UPSERT', |
|
356 | - 'MailingState' => 'CA', |
|
357 | - 'Languages__c' => 'TEST_UPSERT_ID' |
|
358 | - ); |
|
359 | - $external_id = 'Languages__c'; |
|
360 | - try { |
|
361 | - $sObject1 = new SObject(); |
|
362 | - $sObject1->fields = $createFields; |
|
363 | - $sObject1->type = 'Contact'; |
|
364 | - $upsertResponse = $this->mySforceConnection->upsert($external_id, array($sObject1)); |
|
365 | - $this->assertNotNull($upsertResponse); |
|
366 | - $this->assertTrue($upsertResponse->success); |
|
367 | - $id = $upsertResponse->id; |
|
368 | - $ids = array ($id); |
|
369 | - $retrieveFields = 'Id, FirstName, LastName, MailingCity, MailingState'; |
|
370 | - $retrieveResponse = $this->mySforceConnection->retrieve($retrieveFields, 'Contact', $ids); |
|
371 | - $this->assertNotNull($retrieveResponse); |
|
372 | - $sObject = new SObject($retrieveResponse); |
|
373 | - $this->assertEquals($id, $sObject->Id); |
|
374 | - } catch (SoapFault $fault) { |
|
375 | - $this->fail($fault->faultstring); |
|
376 | - } |
|
349 | + // Make the language field an external id field on the contact |
|
350 | + // table before proceeding. |
|
351 | + echo "testUpsert\r\n"; |
|
352 | + $createFields = array ( |
|
353 | + 'FirstName' => 'DELETE_ME', |
|
354 | + 'LastName' => 'DELETE_ME', |
|
355 | + 'MailingCity' => 'TEST_UPSERT', |
|
356 | + 'MailingState' => 'CA', |
|
357 | + 'Languages__c' => 'TEST_UPSERT_ID' |
|
358 | + ); |
|
359 | + $external_id = 'Languages__c'; |
|
360 | + try { |
|
361 | + $sObject1 = new SObject(); |
|
362 | + $sObject1->fields = $createFields; |
|
363 | + $sObject1->type = 'Contact'; |
|
364 | + $upsertResponse = $this->mySforceConnection->upsert($external_id, array($sObject1)); |
|
365 | + $this->assertNotNull($upsertResponse); |
|
366 | + $this->assertTrue($upsertResponse->success); |
|
367 | + $id = $upsertResponse->id; |
|
368 | + $ids = array ($id); |
|
369 | + $retrieveFields = 'Id, FirstName, LastName, MailingCity, MailingState'; |
|
370 | + $retrieveResponse = $this->mySforceConnection->retrieve($retrieveFields, 'Contact', $ids); |
|
371 | + $this->assertNotNull($retrieveResponse); |
|
372 | + $sObject = new SObject($retrieveResponse); |
|
373 | + $this->assertEquals($id, $sObject->Id); |
|
374 | + } catch (SoapFault $fault) { |
|
375 | + $this->fail($fault->faultstring); |
|
376 | + } |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | public function testAssignmentRuleHeaderId() { |
380 | - echo "testAssignmentRuleHeaderId\r\n"; |
|
381 | - $header = new AssignmentRuleHeader('01Q300000005lDgEAI', NULL); |
|
382 | - $createFields = array ( |
|
383 | - 'FirstName' => 'DELETE_ME', |
|
384 | - 'LastName' => 'DELETE_ME', |
|
385 | - 'Email' => '[email protected]', |
|
386 | - 'Company' => 'DELETE_ME Company', |
|
387 | - 'LeadSource' => 'PHPUnit2', |
|
388 | - 'City' => 'San Diego', |
|
389 | - 'State' => 'CA' |
|
390 | - ); |
|
391 | - $sObject1 = new SObject(); |
|
392 | - $sObject1->fields = $createFields; |
|
393 | - $sObject1->type = 'Lead'; |
|
394 | - try { |
|
395 | - $createResponse = $this->mySforceConnection->create(array ($sObject1), $header, NULL); |
|
396 | - } catch (SoapFault $fault) { |
|
397 | - $this->fail($fault->faultstring); |
|
398 | - } |
|
380 | + echo "testAssignmentRuleHeaderId\r\n"; |
|
381 | + $header = new AssignmentRuleHeader('01Q300000005lDgEAI', NULL); |
|
382 | + $createFields = array ( |
|
383 | + 'FirstName' => 'DELETE_ME', |
|
384 | + 'LastName' => 'DELETE_ME', |
|
385 | + 'Email' => '[email protected]', |
|
386 | + 'Company' => 'DELETE_ME Company', |
|
387 | + 'LeadSource' => 'PHPUnit2', |
|
388 | + 'City' => 'San Diego', |
|
389 | + 'State' => 'CA' |
|
390 | + ); |
|
391 | + $sObject1 = new SObject(); |
|
392 | + $sObject1->fields = $createFields; |
|
393 | + $sObject1->type = 'Lead'; |
|
394 | + try { |
|
395 | + $createResponse = $this->mySforceConnection->create(array ($sObject1), $header, NULL); |
|
396 | + } catch (SoapFault $fault) { |
|
397 | + $this->fail($fault->faultstring); |
|
398 | + } |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | public function testAssignmentRuleHeaderFlag() { |
402 | - echo "testAssignmentRuleHeaderFlag\r\n"; |
|
403 | - $header = new AssignmentRuleHeader(NULL, TRUE); |
|
404 | - $createFields = array ( |
|
405 | - 'FirstName' => 'DELETE_ME', |
|
406 | - 'LastName' => 'DELETE_ME', |
|
407 | - 'Email' => '[email protected]', |
|
408 | - 'Company' => 'DELETE_ME Company', |
|
409 | - 'LeadSource' => 'PHPUnit2', |
|
410 | - 'City' => 'San Diego', |
|
411 | - 'State' => 'CA' |
|
412 | - ); |
|
413 | - $sObject1 = new SObject(); |
|
414 | - $sObject1->fields = $createFields; |
|
415 | - $sObject1->type = 'Lead'; |
|
416 | - try { |
|
417 | - $createResponse = $this->mySforceConnection->create(array ($sObject1), $header, NULL); |
|
418 | - $this->assertNotNull($createResponse); |
|
419 | - $this->assertTrue($createResponse->success); |
|
420 | - } catch (SoapFault $fault) { |
|
421 | - $this->fail($fault->faultstring); |
|
422 | - } |
|
402 | + echo "testAssignmentRuleHeaderFlag\r\n"; |
|
403 | + $header = new AssignmentRuleHeader(NULL, TRUE); |
|
404 | + $createFields = array ( |
|
405 | + 'FirstName' => 'DELETE_ME', |
|
406 | + 'LastName' => 'DELETE_ME', |
|
407 | + 'Email' => '[email protected]', |
|
408 | + 'Company' => 'DELETE_ME Company', |
|
409 | + 'LeadSource' => 'PHPUnit2', |
|
410 | + 'City' => 'San Diego', |
|
411 | + 'State' => 'CA' |
|
412 | + ); |
|
413 | + $sObject1 = new SObject(); |
|
414 | + $sObject1->fields = $createFields; |
|
415 | + $sObject1->type = 'Lead'; |
|
416 | + try { |
|
417 | + $createResponse = $this->mySforceConnection->create(array ($sObject1), $header, NULL); |
|
418 | + $this->assertNotNull($createResponse); |
|
419 | + $this->assertTrue($createResponse->success); |
|
420 | + } catch (SoapFault $fault) { |
|
421 | + $this->fail($fault->faultstring); |
|
422 | + } |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | public function testMruHeader() { |
426 | - echo "testMruHeader\r\n"; |
|
427 | - $header = new MruHeader(TRUE); |
|
428 | - $createFields = array ( |
|
429 | - 'FirstName' => 'DELETE_ME', |
|
430 | - 'LastName' => 'DELETE_ME', |
|
431 | - 'MailingCity' => 'San Diego', |
|
432 | - 'MailingState' => 'CA' |
|
433 | - ); |
|
434 | - $sObject1 = new SObject(); |
|
435 | - $sObject1->fields = $createFields; |
|
436 | - $sObject1->type = 'Contact'; |
|
437 | - try { |
|
438 | - $createResponse = $this->mySforceConnection->create(array ($sObject1), NULL, $header); |
|
439 | - $this->assertNotNull($createResponse); |
|
440 | - $this->assertTrue($createResponse->success); |
|
441 | - } catch (SoapFault $fault) { |
|
442 | - $this->fail($fault->faultstring); |
|
443 | - } |
|
426 | + echo "testMruHeader\r\n"; |
|
427 | + $header = new MruHeader(TRUE); |
|
428 | + $createFields = array ( |
|
429 | + 'FirstName' => 'DELETE_ME', |
|
430 | + 'LastName' => 'DELETE_ME', |
|
431 | + 'MailingCity' => 'San Diego', |
|
432 | + 'MailingState' => 'CA' |
|
433 | + ); |
|
434 | + $sObject1 = new SObject(); |
|
435 | + $sObject1->fields = $createFields; |
|
436 | + $sObject1->type = 'Contact'; |
|
437 | + try { |
|
438 | + $createResponse = $this->mySforceConnection->create(array ($sObject1), NULL, $header); |
|
439 | + $this->assertNotNull($createResponse); |
|
440 | + $this->assertTrue($createResponse->success); |
|
441 | + } catch (SoapFault $fault) { |
|
442 | + $this->fail($fault->faultstring); |
|
443 | + } |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | public function testSearch() { |
447 | - echo "testSearch\r\n"; |
|
448 | - try { |
|
449 | - $searchResponse |
|
450 | - = $this->mySforceConnection->search('FIND {DELETE_ME} returning contact(id, phone, firstname, lastname)'); |
|
451 | - $this->assertNotNull($searchResponse); |
|
452 | - } catch (SoapFault $fault) { |
|
453 | - $this->fail($fault->faultstring); |
|
454 | - } |
|
447 | + echo "testSearch\r\n"; |
|
448 | + try { |
|
449 | + $searchResponse |
|
450 | + = $this->mySforceConnection->search('FIND {DELETE_ME} returning contact(id, phone, firstname, lastname)'); |
|
451 | + $this->assertNotNull($searchResponse); |
|
452 | + } catch (SoapFault $fault) { |
|
453 | + $this->fail($fault->faultstring); |
|
454 | + } |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | public function testSendSingleEmail() { |
458 | - echo "testSendSingleEmail\r\n"; |
|
459 | - try { |
|
460 | - $singleEmail1 = new SingleEmailMessage(); |
|
461 | - $singleEmail1->toAddresses = "[email protected]"; |
|
462 | - $singleEmail1->plainTextBody = "Hello there"; |
|
463 | - $singleEmail1->subject = "First Single Email"; |
|
464 | - $singleEmail1->saveAsActivity = true; |
|
465 | - $singleEmail1->emailPriority = EMAIL_PRIORITY_LOW; |
|
458 | + echo "testSendSingleEmail\r\n"; |
|
459 | + try { |
|
460 | + $singleEmail1 = new SingleEmailMessage(); |
|
461 | + $singleEmail1->toAddresses = "[email protected]"; |
|
462 | + $singleEmail1->plainTextBody = "Hello there"; |
|
463 | + $singleEmail1->subject = "First Single Email"; |
|
464 | + $singleEmail1->saveAsActivity = true; |
|
465 | + $singleEmail1->emailPriority = EMAIL_PRIORITY_LOW; |
|
466 | 466 | |
467 | - $singleEmail2 = new SingleEmailMessage(); |
|
468 | - $singleEmail2->toAddresses = "[email protected]"; |
|
469 | - $singleEmail2->plainTextBody = "Hello there"; |
|
470 | - $singleEmail2->subject = "Second Single Email"; |
|
471 | - $singleEmail2->saveAsActivity = true; |
|
472 | - $singleEmail2->emailPriority = EMAIL_PRIORITY_LOW; |
|
467 | + $singleEmail2 = new SingleEmailMessage(); |
|
468 | + $singleEmail2->toAddresses = "[email protected]"; |
|
469 | + $singleEmail2->plainTextBody = "Hello there"; |
|
470 | + $singleEmail2->subject = "Second Single Email"; |
|
471 | + $singleEmail2->saveAsActivity = true; |
|
472 | + $singleEmail2->emailPriority = EMAIL_PRIORITY_LOW; |
|
473 | 473 | |
474 | - $emailResponse = $this->mySforceConnection->sendSingleEmail(array ($singleEmail1, $singleEmail2)); |
|
475 | - $this->assertNotNull($emailResponse); |
|
476 | - } catch (SoapFault $fault) { |
|
477 | - $this->fail($fault->faultstring); |
|
478 | - } |
|
474 | + $emailResponse = $this->mySforceConnection->sendSingleEmail(array ($singleEmail1, $singleEmail2)); |
|
475 | + $this->assertNotNull($emailResponse); |
|
476 | + } catch (SoapFault $fault) { |
|
477 | + $this->fail($fault->faultstring); |
|
478 | + } |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | public function testSendMassEmail() { |
482 | - echo "testSendMassEmail\r\n"; |
|
483 | - try { |
|
484 | - $massEmail = new MassEmailMessage(); |
|
485 | - $massEmail->subject = "Nicks Mass Email Message"; |
|
486 | - $massEmail->saveAsActivity = true; |
|
487 | - $massEmail->emailPriority = EMAIL_PRIORITY_LOW; |
|
488 | - $massEmail->templateId = "00X50000000wX9q"; |
|
489 | - $massEmail->targetObjectIds = array ("0035000000PiCMd"); |
|
482 | + echo "testSendMassEmail\r\n"; |
|
483 | + try { |
|
484 | + $massEmail = new MassEmailMessage(); |
|
485 | + $massEmail->subject = "Nicks Mass Email Message"; |
|
486 | + $massEmail->saveAsActivity = true; |
|
487 | + $massEmail->emailPriority = EMAIL_PRIORITY_LOW; |
|
488 | + $massEmail->templateId = "00X50000000wX9q"; |
|
489 | + $massEmail->targetObjectIds = array ("0035000000PiCMd"); |
|
490 | 490 | |
491 | - $emailResponse = $this->mySforceConnection->sendMassEmail(array($massEmail)); |
|
491 | + $emailResponse = $this->mySforceConnection->sendMassEmail(array($massEmail)); |
|
492 | 492 | |
493 | - $this->assertNotNull($emailResponse); |
|
494 | - } catch (SoapFault $fault) { |
|
495 | - $this->fail($fault->faultstring); |
|
496 | - } |
|
493 | + $this->assertNotNull($emailResponse); |
|
494 | + } catch (SoapFault $fault) { |
|
495 | + $this->fail($fault->faultstring); |
|
496 | + } |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | public function testEmptyRecycleBin() { |
500 | - echo "testEmptyRecycleBin\r\n"; |
|
501 | - try { |
|
502 | - $fields = array ( |
|
503 | - 'Type' => 'Electrical' |
|
504 | - ); |
|
500 | + echo "testEmptyRecycleBin\r\n"; |
|
501 | + try { |
|
502 | + $fields = array ( |
|
503 | + 'Type' => 'Electrical' |
|
504 | + ); |
|
505 | 505 | |
506 | - $sObject = new SObject(); |
|
507 | - $sObject->fields = $fields; |
|
508 | - $sObject->type = 'Case'; |
|
506 | + $sObject = new SObject(); |
|
507 | + $sObject->fields = $fields; |
|
508 | + $sObject->type = 'Case'; |
|
509 | 509 | |
510 | - //echo "Creating Case:\n"; |
|
511 | - $response = $this->mySforceConnection->create(array ($sObject)); |
|
512 | - $this->assertNotNull($response); |
|
513 | - $id = $response->id; |
|
514 | - //echo "Deleted Case:\n"; |
|
515 | - $response = $this->mySforceConnection->delete(array($id)); |
|
516 | - $this->assertNotNull($response); |
|
517 | - //echo "Empty Recycle Bin:\n"; |
|
518 | - $response = $this->mySforceConnection->emptyRecycleBin(array($id)); |
|
519 | - $this->assertNotNull($response); |
|
520 | - } catch (SoapFault $fault) { |
|
521 | - $this->fail($fault->faultstring); |
|
522 | - } |
|
510 | + //echo "Creating Case:\n"; |
|
511 | + $response = $this->mySforceConnection->create(array ($sObject)); |
|
512 | + $this->assertNotNull($response); |
|
513 | + $id = $response->id; |
|
514 | + //echo "Deleted Case:\n"; |
|
515 | + $response = $this->mySforceConnection->delete(array($id)); |
|
516 | + $this->assertNotNull($response); |
|
517 | + //echo "Empty Recycle Bin:\n"; |
|
518 | + $response = $this->mySforceConnection->emptyRecycleBin(array($id)); |
|
519 | + $this->assertNotNull($response); |
|
520 | + } catch (SoapFault $fault) { |
|
521 | + $this->fail($fault->faultstring); |
|
522 | + } |
|
523 | 523 | } |
524 | 524 | |
525 | 525 |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | |
49 | 49 | public function deleteAll($queryResult) { |
50 | 50 | $records = $queryResult->records; |
51 | - $ids = array (); |
|
51 | + $ids = array(); |
|
52 | 52 | $buckets = array_chunk($records, 200); |
53 | 53 | foreach ($buckets as $bucket) { |
54 | - $ids = array (); |
|
54 | + $ids = array(); |
|
55 | 55 | foreach ($bucket as $record) { |
56 | 56 | $sObject = new SObject($record); |
57 | 57 | //var_dump($sObject); |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | $createQueryResult = $this->mySforceConnection->query($createQuery, $queryOptions); |
88 | 88 | $leadQueryResult = $this->mySforceConnection->query($leadQuery, $queryOptions); |
89 | 89 | if ($createQueryResult->size > 0) { |
90 | - echo 'Deleting '.$createQueryResult->size." contacts.\r\n"; |
|
90 | + echo 'Deleting ' . $createQueryResult->size . " contacts.\r\n"; |
|
91 | 91 | $this->deleteAll($createQueryResult); |
92 | 92 | } |
93 | 93 | if ($leadQueryResult->size > 0) { |
94 | 94 | $this->deleteAll($leadQueryResult); |
95 | 95 | } |
96 | - $createFields = array ( |
|
96 | + $createFields = array( |
|
97 | 97 | 'FirstName' => 'DELETE_ME', |
98 | 98 | 'LastName' => 'DELETE_ME', |
99 | 99 | 'MailingCity' => 'San Diego', |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | public function testDescribeSObjects() { |
162 | 162 | echo "testDescribeSObjects\r\n"; |
163 | 163 | try { |
164 | - $response = $this->mySforceConnection->describeSObjects(array ( |
|
164 | + $response = $this->mySforceConnection->describeSObjects(array( |
|
165 | 165 | 'Account', |
166 | 166 | 'Contact' |
167 | 167 | )); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | public function testRetrieve() { |
213 | 213 | echo "testRetrieve\r\n"; |
214 | 214 | try { |
215 | - $ids = array ($this->theId); |
|
215 | + $ids = array($this->theId); |
|
216 | 216 | $this->assertEquals(1, count($ids)); |
217 | 217 | |
218 | 218 | $retrieveFields = 'LastName'; |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | try { |
234 | 234 | $id = $this->theId; |
235 | 235 | $this->assertNotNull($id); |
236 | - $updateFields = array ( |
|
236 | + $updateFields = array( |
|
237 | 237 | 'Id' => $id, |
238 | 238 | 'MailingCity' => 'New York', |
239 | 239 | 'MailingState' => 'NY' |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $sObject1 = new SObject(); |
242 | 242 | $sObject1->fields = $updateFields; |
243 | 243 | $sObject1->type = 'Contact'; |
244 | - $updateResponse = $this->mySforceConnection->update(array ($sObject1)); |
|
244 | + $updateResponse = $this->mySforceConnection->update(array($sObject1)); |
|
245 | 245 | $this->assertNotNull($updateResponse); |
246 | 246 | $this->assertTrue($updateResponse->success); |
247 | 247 | } catch (SoapFault $fault) { |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $type = 'Contact'; |
256 | 256 | $currentTime = mktime(); |
257 | 257 | // assume that create or update occured within the last 5 mins. |
258 | - $startTime = $currentTime-(60*5); |
|
258 | + $startTime = $currentTime - (60 * 5); |
|
259 | 259 | $endTime = $currentTime; |
260 | 260 | $response = $this->mySforceConnection->getUpdated($type, $startTime, $endTime); |
261 | 261 | $this->assertNotNull($response); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | public function testDelete() { |
269 | 269 | echo "testDelete\r\n"; |
270 | 270 | try { |
271 | - $ids = array ($this->theId); |
|
271 | + $ids = array($this->theId); |
|
272 | 272 | $this->assertEquals(1, count($ids)); |
273 | 273 | $response = $this->mySforceConnection->delete($ids); |
274 | 274 | $this->assertNotNull($response); |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | $type = 'Contact'; |
285 | 285 | $currentTime = mktime(); |
286 | 286 | // assume that delete occured within the last 5 mins. |
287 | - $startTime = $currentTime-(60*10); |
|
287 | + $startTime = $currentTime - (60 * 10); |
|
288 | 288 | $endTime = $currentTime; |
289 | 289 | $response = $this->mySforceConnection->getDeleted($type, $startTime, $endTime); |
290 | 290 | if (isset($response)) { |
291 | 291 | $this->assertNotNull(count($response->deletedRecords)); |
292 | - echo'deleted records = '.count($response->deletedRecords)."\r\n"; |
|
292 | + echo'deleted records = ' . count($response->deletedRecords) . "\r\n"; |
|
293 | 293 | } |
294 | 294 | } catch (SoapFault $fault) { |
295 | 295 | $this->fail($fault->faultstring); |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | // Make the language field an external id field on the contact |
350 | 350 | // table before proceeding. |
351 | 351 | echo "testUpsert\r\n"; |
352 | - $createFields = array ( |
|
352 | + $createFields = array( |
|
353 | 353 | 'FirstName' => 'DELETE_ME', |
354 | 354 | 'LastName' => 'DELETE_ME', |
355 | 355 | 'MailingCity' => 'TEST_UPSERT', |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | $this->assertNotNull($upsertResponse); |
366 | 366 | $this->assertTrue($upsertResponse->success); |
367 | 367 | $id = $upsertResponse->id; |
368 | - $ids = array ($id); |
|
368 | + $ids = array($id); |
|
369 | 369 | $retrieveFields = 'Id, FirstName, LastName, MailingCity, MailingState'; |
370 | 370 | $retrieveResponse = $this->mySforceConnection->retrieve($retrieveFields, 'Contact', $ids); |
371 | 371 | $this->assertNotNull($retrieveResponse); |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | public function testAssignmentRuleHeaderId() { |
380 | 380 | echo "testAssignmentRuleHeaderId\r\n"; |
381 | 381 | $header = new AssignmentRuleHeader('01Q300000005lDgEAI', NULL); |
382 | - $createFields = array ( |
|
382 | + $createFields = array( |
|
383 | 383 | 'FirstName' => 'DELETE_ME', |
384 | 384 | 'LastName' => 'DELETE_ME', |
385 | 385 | 'Email' => '[email protected]', |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $sObject1->fields = $createFields; |
393 | 393 | $sObject1->type = 'Lead'; |
394 | 394 | try { |
395 | - $createResponse = $this->mySforceConnection->create(array ($sObject1), $header, NULL); |
|
395 | + $createResponse = $this->mySforceConnection->create(array($sObject1), $header, NULL); |
|
396 | 396 | } catch (SoapFault $fault) { |
397 | 397 | $this->fail($fault->faultstring); |
398 | 398 | } |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | public function testAssignmentRuleHeaderFlag() { |
402 | 402 | echo "testAssignmentRuleHeaderFlag\r\n"; |
403 | 403 | $header = new AssignmentRuleHeader(NULL, TRUE); |
404 | - $createFields = array ( |
|
404 | + $createFields = array( |
|
405 | 405 | 'FirstName' => 'DELETE_ME', |
406 | 406 | 'LastName' => 'DELETE_ME', |
407 | 407 | 'Email' => '[email protected]', |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $sObject1->fields = $createFields; |
415 | 415 | $sObject1->type = 'Lead'; |
416 | 416 | try { |
417 | - $createResponse = $this->mySforceConnection->create(array ($sObject1), $header, NULL); |
|
417 | + $createResponse = $this->mySforceConnection->create(array($sObject1), $header, NULL); |
|
418 | 418 | $this->assertNotNull($createResponse); |
419 | 419 | $this->assertTrue($createResponse->success); |
420 | 420 | } catch (SoapFault $fault) { |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | public function testMruHeader() { |
426 | 426 | echo "testMruHeader\r\n"; |
427 | 427 | $header = new MruHeader(TRUE); |
428 | - $createFields = array ( |
|
428 | + $createFields = array( |
|
429 | 429 | 'FirstName' => 'DELETE_ME', |
430 | 430 | 'LastName' => 'DELETE_ME', |
431 | 431 | 'MailingCity' => 'San Diego', |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $sObject1->fields = $createFields; |
436 | 436 | $sObject1->type = 'Contact'; |
437 | 437 | try { |
438 | - $createResponse = $this->mySforceConnection->create(array ($sObject1), NULL, $header); |
|
438 | + $createResponse = $this->mySforceConnection->create(array($sObject1), NULL, $header); |
|
439 | 439 | $this->assertNotNull($createResponse); |
440 | 440 | $this->assertTrue($createResponse->success); |
441 | 441 | } catch (SoapFault $fault) { |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | $singleEmail2->saveAsActivity = true; |
472 | 472 | $singleEmail2->emailPriority = EMAIL_PRIORITY_LOW; |
473 | 473 | |
474 | - $emailResponse = $this->mySforceConnection->sendSingleEmail(array ($singleEmail1, $singleEmail2)); |
|
474 | + $emailResponse = $this->mySforceConnection->sendSingleEmail(array($singleEmail1, $singleEmail2)); |
|
475 | 475 | $this->assertNotNull($emailResponse); |
476 | 476 | } catch (SoapFault $fault) { |
477 | 477 | $this->fail($fault->faultstring); |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | $massEmail->saveAsActivity = true; |
487 | 487 | $massEmail->emailPriority = EMAIL_PRIORITY_LOW; |
488 | 488 | $massEmail->templateId = "00X50000000wX9q"; |
489 | - $massEmail->targetObjectIds = array ("0035000000PiCMd"); |
|
489 | + $massEmail->targetObjectIds = array("0035000000PiCMd"); |
|
490 | 490 | |
491 | 491 | $emailResponse = $this->mySforceConnection->sendMassEmail(array($massEmail)); |
492 | 492 | |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | public function testEmptyRecycleBin() { |
500 | 500 | echo "testEmptyRecycleBin\r\n"; |
501 | 501 | try { |
502 | - $fields = array ( |
|
502 | + $fields = array( |
|
503 | 503 | 'Type' => 'Electrical' |
504 | 504 | ); |
505 | 505 | |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | $sObject->type = 'Case'; |
509 | 509 | |
510 | 510 | //echo "Creating Case:\n"; |
511 | - $response = $this->mySforceConnection->create(array ($sObject)); |
|
511 | + $response = $this->mySforceConnection->create(array($sObject)); |
|
512 | 512 | $this->assertNotNull($response); |
513 | 513 | $id = $response->id; |
514 | 514 | //echo "Deleted Case:\n"; |
@@ -5,14 +5,14 @@ |
||
5 | 5 | |
6 | 6 | |
7 | 7 | define("SOAP_CLIENT_BASEDIR", "../soapclient"); |
8 | -$USERNAME='[email protected]'; |
|
9 | -$PASSWORD="sa13sf0rc3"; |
|
10 | -require_once (SOAP_CLIENT_BASEDIR.'/SforcePartnerClient.php'); |
|
11 | -require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php'); |
|
8 | +$USERNAME = '[email protected]'; |
|
9 | +$PASSWORD = "sa13sf0rc3"; |
|
10 | +require_once (SOAP_CLIENT_BASEDIR . '/SforcePartnerClient.php'); |
|
11 | +require_once (SOAP_CLIENT_BASEDIR . '/SforceHeaderOptions.php'); |
|
12 | 12 | |
13 | 13 | try { |
14 | 14 | $mySforceConnection = new SforcePartnerClient(); |
15 | - $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml'); |
|
15 | + $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR . '/enterprise.wsdl.xml'); |
|
16 | 16 | $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD); |
17 | 17 | |
18 | 18 | echo "***** Get Server Timestamp *****\n"; |
@@ -9,8 +9,8 @@ discard block |
||
9 | 9 | */ |
10 | 10 | public function getById($id) |
11 | 11 | { |
12 | - $id = (int)$id; |
|
13 | - if($id <= 0 || $id > sizeof($this->_values)) { |
|
12 | + $id = (int) $id; |
|
13 | + if ($id <= 0 || $id > sizeof($this->_values)) { |
|
14 | 14 | return NULL; |
15 | 15 | } |
16 | 16 | |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function validateId($id) |
27 | 27 | { |
28 | - if(!is_numeric($id)){ |
|
28 | + if ( ! is_numeric($id)) { |
|
29 | 29 | return FALSE; |
30 | 30 | } |
31 | - $id = (int)$id; |
|
32 | - if($id <= 0) { |
|
31 | + $id = (int) $id; |
|
32 | + if ($id <= 0) { |
|
33 | 33 | return FALSE; |
34 | 34 | } |
35 | 35 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function validateValue($value) |
46 | 46 | { |
47 | - if($value == '') { |
|
47 | + if ($value == '') { |
|
48 | 48 | return false; |
49 | 49 | } |
50 | 50 | return in_array($value, $this->_values); |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | $metaInfoLogger->write(basename($this->getLogName()) . ' - test failed!'); |
83 | 83 | } |
84 | 84 | |
85 | - $metaInfoLogger->write('Total time: '. ($end_time - $start_time)); |
|
86 | - $metaInfoLogger->write('Max allocated memory: '. memory_get_peak_usage(TRUE)); |
|
85 | + $metaInfoLogger->write('Total time: ' . ($end_time - $start_time)); |
|
86 | + $metaInfoLogger->write('Max allocated memory: ' . memory_get_peak_usage(TRUE)); |
|
87 | 87 | } catch (Exception $e) { |
88 | 88 | $this->_logger->write($this->_mySforceConnection->getLastRequest()); |
89 | 89 | ob_start(); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | public function getLogName() |
103 | 103 | { |
104 | 104 | return $this->_soapDir . '/results/' . $this->getTestName() . '_' . $this->getWSDLName() . '_' . |
105 | - $this->getWSDLVersion() . '_' . phpversion(); |
|
105 | + $this->getWSDLVersion() . '_' . phpversion(); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | protected function _getMetaDataWSDL() |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | protected function _validate($rs) |
127 | 127 | { |
128 | 128 | // generic check |
129 | - if(strpos($rs, 'errors') !== FALSE) { |
|
129 | + if (strpos($rs, 'errors') !== FALSE) { |
|
130 | 130 | throw new Lib_Exception_InvalidResponse(); |
131 | 131 | } |
132 | 132 | } |
@@ -9,10 +9,10 @@ |
||
9 | 9 | protected function _run() |
10 | 10 | { |
11 | 11 | $sObject = new stdclass(); |
12 | - $sObject->Type='Electrical'; |
|
13 | - $sObject->Status='New'; |
|
12 | + $sObject->Type = 'Electrical'; |
|
13 | + $sObject->Status = 'New'; |
|
14 | 14 | |
15 | - $response = $this->_mySforceConnection->create(array ($sObject), 'Case'); |
|
15 | + $response = $this->_mySforceConnection->create(array($sObject), 'Case'); |
|
16 | 16 | echo "***** Creating Case *****\n"; |
17 | 17 | print_r($response); |
18 | 18 | $id = $response->id; |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | protected function _validateSoapFault($rs) |
27 | 27 | { |
28 | - if(strpos($rs, 'INVALID_SESSION_ID') === FALSE) { |
|
28 | + if (strpos($rs, 'INVALID_SESSION_ID') === FALSE) { |
|
29 | 29 | throw new Lib_Exception_InvalidResponse(); |
30 | 30 | } |
31 | 31 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | print_r($createResponse); |
20 | 20 | |
21 | 21 | $id = $createResponse->id; |
22 | - $deleteResponse = $this->_mySforceConnection->delete(array ($id)); |
|
22 | + $deleteResponse = $this->_mySforceConnection->delete(array($id)); |
|
23 | 23 | echo "***** Deleting record *****\n"; |
24 | 24 | print_r($deleteResponse); |
25 | 25 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | $currentTime = mktime(); |
30 | 30 | // assume that delete occured within the last 5 mins. |
31 | - $startTime = $currentTime - (60*10); |
|
31 | + $startTime = $currentTime - (60 * 10); |
|
32 | 32 | $endTime = $currentTime; |
33 | 33 | |
34 | 34 | echo "***** Get Deleted Leads *****\n"; |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | protected function _validateSoapFault($rs) |
27 | 27 | { |
28 | - if(strpos($rs, 'INVALID_SESSION_ID') === FALSE) { |
|
28 | + if (strpos($rs, 'INVALID_SESSION_ID') === FALSE) { |
|
29 | 29 | throw new Lib_Exception_InvalidResponse(); |
30 | 30 | } |
31 | 31 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | $processWorkItemRequest->workitemId = $WORKITEM; |
19 | 19 | $processWorkItemRequest->comments = "Item has been approved."; |
20 | 20 | |
21 | - $response = $this->_mySforceConnection->processWorkitemRequest(array ($processWorkItemRequest)); |
|
21 | + $response = $this->_mySforceConnection->processWorkitemRequest(array($processWorkItemRequest)); |
|
22 | 22 | |
23 | 23 | print_r($response); |
24 | 24 | echo $this->_mySforceConnection->getLastRequest(); |