Skip to content

Commit

Permalink
Configure Eclipse validation rules.
Browse files Browse the repository at this point in the history
Update composer.json dependencies.
Update Grunt dependencies.
Re-process files with new version of PHP_CodeSniffer.
  • Loading branch information
bgaillard committed Apr 26, 2015
1 parent 564f687 commit 941161e
Show file tree
Hide file tree
Showing 13 changed files with 132 additions and 15 deletions.
53 changes: 52 additions & 1 deletion .buildpath
Original file line number Diff line number Diff line change
@@ -1,5 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
<buildpathentry kind="src" path=""/>
<buildpathentry kind="src" path="src/main/php/Gomoob"/>
<buildpathentry kind="src" path="vendor/phpunit/php-token-stream/src"/>
<buildpathentry kind="src" path="vendor/sebastian/environment/src"/>
<buildpathentry kind="src" path="vendor/codeclimate/php-test-reporter/src"/>
<buildpathentry kind="src" path="vendor/phpunit/php-file-iterator/src"/>
<buildpathentry kind="src" path="vendor/sebastian/finder-facade/src"/>
<buildpathentry kind="src" path="vendor/sebastian/global-state/src"/>
<buildpathentry kind="src" path="vendor/sebastian/phpcpd/src"/>
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
<buildpathentry kind="src" path="vendor/doctrine/instantiator/src"/>
<buildpathentry kind="src" path="vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PSR1/Sniffs"/>
<buildpathentry kind="src" path="vendor/phpunit/php-text-template/Text"/>
<buildpathentry kind="src" path="vendor/sebastian/git/src"/>
<buildpathentry kind="src" path="vendor/sebastian/comparator/src"/>
<buildpathentry kind="src" path="vendor/symfony/filesystem"/>
<buildpathentry kind="src" path="vendor/symfony/stopwatch"/>
<buildpathentry kind="src" path="vendor/phpunit/phpunit-mock-objects/src"/>
<buildpathentry kind="src" path="vendor/sebastian/exporter/src"/>
<buildpathentry kind="src" path="vendor/guzzle/guzzle/tests"/>
<buildpathentry kind="src" path="vendor/squizlabs/php_codesniffer/CodeSniffer/Tokenizers"/>
<buildpathentry kind="src" path="vendor/symfony/finder"/>
<buildpathentry kind="src" path="vendor/symfony/dependency-injection"/>
<buildpathentry excluding="Generic/Sniffs/|MySource/Sniffs/|PEAR/Sniffs/|PSR1/Sniffs/|PSR2/Sniffs/|Squiz/Sniffs/|Zend/Sniffs/" kind="src" path="vendor/squizlabs/php_codesniffer/CodeSniffer/Standards"/>
<buildpathentry kind="src" path="vendor/phpspec/prophecy/src"/>
<buildpathentry excluding="DocGenerators/|Reports/|Standards/|Tokenizers/" kind="src" path="vendor/squizlabs/php_codesniffer/CodeSniffer"/>
<buildpathentry kind="src" path="vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PSR2/Sniffs"/>
<buildpathentry kind="src" path="vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs"/>
<buildpathentry kind="src" path="vendor/phpunit/phpunit/src"/>
<buildpathentry kind="src" path="vendor/symfony/event-dispatcher"/>
<buildpathentry kind="src" path="vendor/symfony/console"/>
<buildpathentry kind="src" path="vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/MySource/Sniffs"/>
<buildpathentry kind="src" path="vendor/squizlabs/php_codesniffer/CodeSniffer/DocGenerators"/>
<buildpathentry kind="src" path="vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs"/>
<buildpathentry kind="src" path="vendor/pdepend/pdepend/src/main/php"/>
<buildpathentry kind="src" path="vendor/symfony/config"/>
<buildpathentry kind="src" path="vendor/symfony/yaml"/>
<buildpathentry kind="src" path="vendor/sebastian/diff/src"/>
<buildpathentry kind="src" path="vendor/phpunit/php-timer/PHP"/>
<buildpathentry kind="src" path="vendor/sebastian/version/src"/>
<buildpathentry kind="src" path="vendor/psr/log"/>
<buildpathentry kind="src" path="vendor/phpdocumentor/reflection-docblock/src"/>
<buildpathentry kind="src" path="vendor/theseer/fdomdocument/src"/>
<buildpathentry kind="src" path="vendor/sebastian/recursion-context/src"/>
<buildpathentry kind="src" path="vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PEAR/Sniffs"/>
<buildpathentry kind="src" path="vendor/guzzle/guzzle/src"/>
<buildpathentry kind="src" path="vendor/phpunit/php-code-coverage/src"/>
<buildpathentry kind="src" path="vendor/phpmd/phpmd/src/main/php"/>
<buildpathentry kind="src" path="vendor/composer"/>
<buildpathentry excluding="CodeSniffer/" kind="src" path="vendor/squizlabs/php_codesniffer"/>
<buildpathentry kind="src" path="vendor/phploc/phploc/src"/>
<buildpathentry kind="src" path="vendor/satooshi/php-coveralls/src"/>
<buildpathentry kind="src" path="vendor/squizlabs/php_codesniffer/CodeSniffer/Reports"/>
<buildpathentry kind="src" path="vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Zend/Sniffs"/>
</buildpath>
6 changes: 6 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.dubture.composer.core.builder.buildPathManagementBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
Expand All @@ -24,5 +29,6 @@
<natures>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.php.core.PHPNature</nature>
<nature>com.dubture.composer.core.composerNature</nature>
</natures>
</projectDescription>
1 change: 1 addition & 0 deletions .settings/org.eclipse.wst.common.project.facet.core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
<fixed facet="php.component"/>
<installed facet="php.core.component" version="1"/>
<installed facet="php.component" version="5.4"/>
<installed facet="php.composer.component" version="1"/>
</faceted-project>
13 changes: 13 additions & 0 deletions .settings/org.eclipse.wst.validation.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
DELEGATES_PREFERENCE=delegateValidatorList
USER_BUILD_PREFERENCE=enabledBuildValidatorList
USER_MANUAL_PREFERENCE=enabledManualValidatorList
USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.600.v201501211647
disabled=06vendor
eclipse.preferences.version=1
override=true
suspend=false
vals/org.eclipse.php.core.org.eclipse.php.core.PHPTaskValidator/groups=0107include01111contentType130org.eclipse.php.core.phpsourceT0107exclude0104file06vendorF02
vals/org.eclipse.wst.html.core.HTMLValidator/groups=0107include06111contentType136org.eclipse.wst.html.core.htmlsourceT07fileext04htmlF07fileext05xhtmlF07fileext03htmF07fileext04htplF07fileext03wmlF0107exclude0404file05_siteF0204file112node_modulesF0204file06vendorF0204file05buildF02
vals/org.eclipse.wst.xml.core.xml/groups=0107include05111contentType128org.eclipse.core.runtime.xmlT111contentType134org.eclipse.wst.xml.core.xmlsourceT111contentType134org.eclipse.wst.xml.core.xslsourceT111contentType134org.eclipse.jst.jsp.core.tldsourceT07fileext03xmlF0107exclude09113projectNature134org.eclipse.jst.j2ee.ejb.EJBNature113projectNature130org.eclipse.jst.j2ee.EARNature04file08.projectT0104file110.classpathT0104file110.settings/T0204file06vendorF0204file05_siteF0204file112node_modulesF0204file05buildF02
vals/org.eclipse.wst.xsd.core.xsd/groups=0107include0107fileext03xsdF0107exclude0304file05_siteF0204file112node_modulesF0204file06vendorF02
vf.version=3
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ module.exports = function(grunt) {
/**
* Task used to check the code using PHP_CodeSniffer.
*/
grunt.registerTask('phpcs', ['before-phpcs', 'shell:phpcs', ]);
grunt.registerTask('phpcs', ['before-phpcs', 'shell:phpcs']);

/**
* Task used to generate a PHPMD report.
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@
"require-dev" : {
"codeclimate/php-test-reporter" : "~0.1",
"pdepend/pdepend" : "~2.0",
"phploc/phploc" : "~2.0",
"phpmd/phpmd" : "~2.1",
"phploc/phploc" : "~2.1",
"phpmd/phpmd" : "~2.2",
"phpunit/phpunit": "~4.6",
"satooshi/php-coveralls" : "~0.6",
"sebastian/phpcpd" : "~2.0",
"squizlabs/php_codesniffer" : "~2.1"
"squizlabs/php_codesniffer" : "~2.3"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"devDependencies": {
"grunt": "~0.4",
"grunt-contrib-clean": "~0.6",
"grunt-contrib-copy": "~0.7",
"grunt-contrib-copy": "~0.8",
"grunt-phpdocumentor": "~0.4",
"grunt-phpunit": "~0.3",
"grunt-shell": "~1.1",
"load-grunt-tasks" : "~2.0"
"load-grunt-tasks" : "~3.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static function create(array $json)
$createMessageResponse->setStatusMessage($json['status_message']);

// If a 'response' is provided
if (array_key_exists('response', $json)) {
if (array_key_exists('response', $json) && isset($json['response'])) {
$createMessageResponseResponse = new CreateMessageResponseResponse();

// If 'Messages' are provided
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static function create(array $json)
$getNearestZoneResponse->setStatusMessage($json['status_message']);

// If a 'response' is provided
if (array_key_exists('response', $json)) {
if (array_key_exists('response', $json) && isset($json['response'])) {
$getNearestZoneResponseResponse = new GetNearestZoneResponseResponse();
$getNearestZoneResponseResponse->setDistance($json['response']['distance']);
$getNearestZoneResponseResponse->setLat($json['response']['lat']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static function create(array $json)
$getTagsResponse->setStatusMessage($json['status_message']);

// If a 'response' is provided
if (array_key_exists('response', $json)) {
if (array_key_exists('response', $json) && isset($json['response'])) {
$getTagsResponseResponse = new GetTagsResponseResponse();

// If a 'result' is provided
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function testCreate()
$this->assertEquals(200, $createMessageResponse->getStatusCode());
$this->assertEquals('OK', $createMessageResponse->getStatusMessage());

// Test with an error response
// Test with an error response without any 'response' field
$createMessageResponse = CreateMessageResponse::create(
array(
'status_code' => 400,
Expand All @@ -62,5 +62,21 @@ public function testCreate()
$this->assertEquals(400, $createMessageResponse->getStatusCode());
$this->assertEquals('KO', $createMessageResponse->getStatusMessage());

// Test with an error response with a null 'response' field
// Fix https://github.com/gomoob/php-pushwoosh/issues/13
$createMessageResponse = CreateMessageResponse::create(
array(
'status_code' => 400,
'status_message' => 'KO',
'response' => null
)
);

$createMessageResponseResponse = $createMessageResponse->getResponse();
$this->assertNull($createMessageResponseResponse);
$this->assertFalse($createMessageResponse->isOk());
$this->assertEquals(400, $createMessageResponse->getStatusCode());
$this->assertEquals('KO', $createMessageResponse->getStatusMessage());

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,31 @@ public function testCreate()
$this->assertEquals(100, $getNearestZoneResponseResponse->getRange());
$this->assertEquals(4715784, $getNearestZoneResponseResponse->getDistance());

// Test with an error response
// Test with an error response without any 'response' field
$getNearestZoneResponse = GetNearestZoneResponse::create(
array(
'status_code' => 400,
'status_message' => 'KO',
'status_message' => 'KO'
)
);

$this->assertFalse($getNearestZoneResponse->isOk());
$this->assertEquals(400, $getNearestZoneResponse->getStatusCode());
$this->assertEquals('KO', $getNearestZoneResponse->getStatusMessage());

// Test with an error response with a null 'response' field
// Fix https://github.com/gomoob/php-pushwoosh/issues/13
$getNearestZoneResponse = GetNearestZoneResponse::create(
array(
'status_code' => 400,
'status_message' => 'KO',
'response' => null
)
);

$this->assertFalse($getNearestZoneResponse->isOk());
$this->assertEquals(400, $getNearestZoneResponse->getStatusCode());
$this->assertEquals('KO', $getNearestZoneResponse->getStatusMessage());

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function testCreate()
$this->assertEquals(200, $getTagsResponse->getStatusCode());
$this->assertEquals('OK', $getTagsResponse->getStatusMessage());

// Test with an error response
// Test with an error response without any 'response' field
$getTagsResponse = GetTagsResponse::create(
array(
'status_code' => 400,
Expand All @@ -72,6 +72,21 @@ public function testCreate()
$this->assertFalse($getTagsResponse->isOk());
$this->assertEquals(400, $getTagsResponse->getStatusCode());
$this->assertEquals('KO', $getTagsResponse->getStatusMessage());


// Test with an error response with a null 'response' field
// Fix https://github.com/gomoob/php-pushwoosh/issues/13
$getTagsResponse = GetTagsResponse::create(
array(
'status_code' => 400,
'status_message' => 'KO',
'response' => null
)
);

$getTagsResponseResponse = $getTagsResponse->getResponse();
$this->assertNull($getTagsResponseResponse);
$this->assertFalse($getTagsResponse->isOk());
$this->assertEquals(400, $getTagsResponse->getStatusCode());
$this->assertEquals('KO', $getTagsResponse->getStatusMessage());
}
}

0 comments on commit 941161e

Please sign in to comment.