diff options
author | purplecode <niespammnie@gmail.com> | 2014-12-24 12:22:27 +0100 |
---|---|---|
committer | purplecode <niespammnie@gmail.com> | 2014-12-24 12:22:27 +0100 |
commit | 5b74984770c4228808138231c9580d22f7282475 (patch) | |
tree | 76594a6e1ace53e3f67bb400c9311655a1d6b4a6 | |
parent | ffd2008900b34c003e99e09d710586e0435f5af6 (diff) | |
download | php.curl-5b74984770c4228808138231c9580d22f7282475.zip php.curl-5b74984770c4228808138231c9580d22f7282475.tar.gz php.curl-5b74984770c4228808138231c9580d22f7282475.tar.bz2 |
formatting
-rw-r--r-- | src/PurpleCode/PCurl/Json/PJsonCurl.php | 2 | ||||
-rw-r--r-- | test/PCurlTest.php | 60 | ||||
-rw-r--r-- | test/PJsonCurlTest.php | 12 |
3 files changed, 36 insertions, 38 deletions
diff --git a/src/PurpleCode/PCurl/Json/PJsonCurl.php b/src/PurpleCode/PCurl/Json/PJsonCurl.php index 60f151b..2e5aa1a 100644 --- a/src/PurpleCode/PCurl/Json/PJsonCurl.php +++ b/src/PurpleCode/PCurl/Json/PJsonCurl.php @@ -40,7 +40,7 @@ class PJsonCurl extends PCurl { }
private function deserialize($response) {
- $json = json_decode($response, $this->deserializeToArray);
+ $json = json_decode($response, $this->deserializeToArray);
PCurlException::assert($this->isValidJson($response) && json_last_error() == JSON_ERROR_NONE, "Invalid JSON response format");
diff --git a/test/PCurlTest.php b/test/PCurlTest.php index d05f72d..a3c0724 100644 --- a/test/PCurlTest.php +++ b/test/PCurlTest.php @@ -6,43 +6,43 @@ use PurpleCode\PCurl\PCurl; class PCurlTest extends PHPUnit_Framework_TestCase {
- private function getCACertBundlePath() {
- return __DIR__.'\ca-cert.crt';
- }
+ private function getCACertBundlePath() {
+ return __DIR__ . '\ca-cert.crt';
+ }
- public function testShouldGetGooglePageViaHttp() {
- // given
- $cut = new PCurl('http://www.google.pl');
+ public function testShouldGetGooglePageViaHttp() {
+ // given
+ $cut = new PCurl('http://www.google.pl');
- // when
- $response = $cut->get('/');
+ // when
+ $response = $cut->get('/');
- // then
- $this->assertSelectRegExp('title', '/Google/', 1, $response->getBody());
- $this->assertEquals(200, $response->getHttpCode());
+ // then
+ $this->assertSelectRegExp('title', '/Google/', 1, $response->getBody());
+ $this->assertEquals(200, $response->getHttpCode());
}
- public function testShouldGetGooglePageAndCheckHttpsCertificate() {
- // given
- $cut = new PCurl('https://www.google.pl');
- $cut->useSSLCertificate($this->getCACertBundlePath());
+ public function testShouldGetGooglePageAndCheckHttpsCertificate() {
+ // given
+ $cut = new PCurl('https://www.google.pl');
+ $cut->useSSLCertificate($this->getCACertBundlePath());
- // when
- $response = $cut->get('/');
+ // when
+ $response = $cut->get('/');
- // then
- $this->assertSelectRegExp('title', '/Google/', 1, $response->getBody());
- }
+ // then
+ $this->assertSelectRegExp('title', '/Google/', 1, $response->getBody());
+ }
- public function testShouldGetGooglePageAndThrowExceptionOnMissingCertificate() {
- // given
- $cut = new PCurl('https://www.google.com');
+ public function testShouldGetGooglePageAndThrowExceptionOnMissingCertificate() {
+ // given
+ $cut = new PCurl('https://www.google.com');
- // then
- $this->setExpectedException('PurpleCode\PCurl\PCurlException');
+ // then
+ $this->setExpectedException('PurpleCode\PCurl\PCurlException');
- // when
- $response = $cut->get('/');
+ // when
+ $response = $cut->get('/');
}
public function testShouldSetProperResponseCodeOnBadRequest() {
@@ -51,10 +51,9 @@ class PCurlTest extends PHPUnit_Framework_TestCase { // then
//$this->setExpectedException('PurpleCode\PCurl\PCurlException');
-
// when
$response = $cut->get('/');
-
+
// then
$this->assertEquals(404, $response->getHttpCode());
}
@@ -70,5 +69,4 @@ class PCurlTest extends PHPUnit_Framework_TestCase { $response = $cut->get('/')->assertSuccess();
}
-
-}
\ No newline at end of file +}
diff --git a/test/PJsonCurlTest.php b/test/PJsonCurlTest.php index 80f765d..5699227 100644 --- a/test/PJsonCurlTest.php +++ b/test/PJsonCurlTest.php @@ -1,6 +1,5 @@ <?php - require_once (dirname(__FILE__) . '/../src/PurpleCode/PCurl/PCurlResponse.php'); require_once (dirname(__FILE__) . '/../src/PurpleCode/PCurl/Json/PJsonCurlResponse.php'); require_once (dirname(__FILE__) . '/../src/PurpleCode/PCurl/PCurl.php'); @@ -11,12 +10,12 @@ use PurpleCode\PCurl\Json\PJsonCurl; class PJsonCurlTest extends PHPUnit_Framework_TestCase { private function getCACertBundlePath() { - return __DIR__.'\ca-cert.crt'; + return __DIR__ . '\ca-cert.crt'; } public function testShouldGetJsonFileAndParse() { // given - $cut = new PJsonCurl('file:///'.__DIR__.'/test.json'); + $cut = new PJsonCurl('file:///' . __DIR__ . '/test.json'); // when $response = $cut->get(''); @@ -28,12 +27,13 @@ class PJsonCurlTest extends PHPUnit_Framework_TestCase { public function testShouldFailParseWrongFile() { // given - $cut = new PJsonCurl('file:///'.__DIR__.'/testinvalid.json'); + $cut = new PJsonCurl('file:///' . __DIR__ . '/testinvalid.json'); //then $this->setExpectedException('PurpleCode\PCurl\PCurlException'); - + // when $response = $cut->get(''); } -}
\ No newline at end of file + +} |