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

Lib_Test_Enterprise_GetUpdatedTest::getTestName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
class Lib_Test_Enterprise_GetUpdatedTest extends Lib_Test_TestAbstractEnterprise
3
{
4
	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...
5
	{
6
		return 'GetUpdated';
7
	}
8
	
9
	protected function _run()
10
	{
11
		$sObject = new stdclass();
12
		$sObject->FirstName = 'Smith';
13
		$sObject->LastName = 'John';
14
		$sObject->Phone = '510-555-5555';
15
		$sObject->BirthDate = '1927-01-25';
16
		
17
		echo "**** Creating the following:\n";
18
		$createResponse = $this->_mySforceConnection->create(array($sObject), '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...
19
		print_r($createResponse);
0 ignored issues
show
introduced by
The use of function print_r() is discouraged
Loading history...
20
		
21
		$id = $createResponse->id;
22
		echo "***** Updating record *****\n";
23
		$sObject->Id = $id;
24
		$sObject->Phone = '999-999-9999';
25
		$updateResponse = $this->_mySforceConnection->update(array ($sObject), "Contact");
0 ignored issues
show
Unused Code introduced by
The call to SforcePartnerClient::update() 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
There must be no space between the Array keyword and the opening parenthesis
Loading history...
introduced by
No space before closing parenthesis of array is bad style
Loading history...
Coding Style Comprehensibility introduced by
The string literal Contact does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
26
		print_r($updateResponse);
0 ignored issues
show
introduced by
The use of function print_r() is discouraged
Loading history...
27
		
28
		echo "***** Wait 60 seconds *****\n";
29
		sleep(60);
30
		
31
		$currentTime = mktime();
32
		// assume that update occured within the last 5 mins.
33
		$startTime = $currentTime-(60*10);
0 ignored issues
show
introduced by
Expected 1 space before "-"; 0 found
Loading history...
introduced by
Expected 1 space before "*"; 0 found
Loading history...
introduced by
Expected 1 space after "*"; 0 found
Loading history...
34
		$endTime = $currentTime;
35
		
36
		echo "***** Get Updated Leads *****\n";
37
		$getUpdateddResponse = $this->_mySforceConnection->getUpdated('Contact', $startTime, $endTime);
0 ignored issues
show
Documentation introduced by
$startTime is of type integer, but the function expects a object<date>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Documentation introduced by
$endTime is of type integer, but the function expects a object<date>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
38
		print_r($getUpdateddResponse);
0 ignored issues
show
introduced by
The use of function print_r() is discouraged
Loading history...
39
	}
40
}