Test Failed
Push — 135-map-multiple-wordpress-obj... ( 3634c2...bb35fb )
by Jonathan
12:00
created

Lib_Test_Enterprise_CDUTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTestName() 0 4 1
A _run() 0 30 2
1
<?php
2
/**
3
 * Create Delete Undelete Sample 
4
 *
5
 */
6
class Lib_Test_Enterprise_CDUTest extends Lib_Test_TestAbstractEnterprise
7
{
8
	public function getTestName()
0 ignored issues
show
Coding Style introduced by
The function name getTestName is in camel caps, but expected get_test_name instead as per the coding standard.
Loading history...
9
	{
10
		return 'CDU';
11
	}
12
	
13
	protected function _run()
14
	{
15
		$sObject = new stdclass();
16
		$sObject->FirstName = 'Smith';
17
		$sObject->LastName = 'John';
18
		$sObject->Phone = '510-555-5555';
19
		$sObject->BirthDate = '1927-01-25';
20
		
21
		$sObject2 = new stdclass();
22
		$sObject2->FirstName = 'Mary';
23
		$sObject2->LastName = 'Smith';
24
		$sObject2->Phone = '510-486-9969';
25
		$sObject2->BirthDate = '1957-01-25';
26
		
27
		echo "**** Creating the following:\r\n";
28
		$createResponse = $this->_mySforceConnection->create(array($sObject, $sObject2), 'Contact');
0 ignored issues
show
Unused Code introduced by
The call to SforcePartnerClient::create() has too many arguments starting with 'Contact'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
introduced by
No space after opening parenthesis of array is bad style
Loading history...
introduced by
No space before closing parenthesis of array is bad style
Loading history...
29
		
30
		$ids = array();
31
		foreach ($createResponse as $createResult) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
32
		  print_r($createResult);
0 ignored issues
show
introduced by
The use of function print_r() is discouraged
Loading history...
33
		  array_push($ids, $createResult->id);
34
		}
35
		echo "**** Now for Delete:\r\n";
36
		$deleteResult = $this->_mySforceConnection->delete($ids);
37
		print_r($deleteResult);
0 ignored issues
show
introduced by
The use of function print_r() is discouraged
Loading history...
38
		
39
		echo "**** Now for UnDelete:\r\n";
40
		$deleteResult = $this->_mySforceConnection->undelete($ids);
41
		print_r($deleteResult);
0 ignored issues
show
introduced by
The use of function print_r() is discouraged
Loading history...
42
	}
43
}