From 11b09cc071c4afcb9ab89c1956975b62ba663b44 Mon Sep 17 00:00:00 2001 From: Stefan Dvoretskii Date: Mon, 21 Nov 2016 22:55:22 +0100 Subject: [PATCH 1/4] Modified deprecated constructor & properly formatted assertions --- test/all.php | 4 ++-- test/remote.php | 7 +++++-- test/unit/AddressTest.php | 4 ++-- test/unit/CurlTest.php | 10 +++++++--- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/test/all.php b/test/all.php index 1c12ea8..2ec3930 100644 --- a/test/all.php +++ b/test/all.php @@ -2,8 +2,8 @@ require_once 'test_helper.php'; class AllTests extends TestSuite { - function __construct() { - $this->TestSuite('all tests'); + function __construct($label=false) { + $this->label = $label; $this->collect(__DIR__.'/unit', new SimpleCollector()); } } diff --git a/test/remote.php b/test/remote.php index 1bc1c04..d1befe5 100644 --- a/test/remote.php +++ b/test/remote.php @@ -2,9 +2,12 @@ require_once 'test_helper.php'; class RemoteTests extends TestSuite { + + function __construct() { - $this->TestSuite('Remote tests'); - + $this->label = 'Remote tests'; + //??? next string means?? + //$this->TestSuite('Remote tests'); // TODO: maik, v2 Scheduler not usable atm. // $this->collect(__DIR__.'/integration', new SimpleCollector()); // TODO: maik, remove the next 2 lines when v2 Scheduler was fixed. diff --git a/test/unit/AddressTest.php b/test/unit/AddressTest.php index d0b1511..94a175c 100644 --- a/test/unit/AddressTest.php +++ b/test/unit/AddressTest.php @@ -39,10 +39,10 @@ function testSerialize() { Hans Hübner Kuhrfürstenstr. 124 - + 10578 Berlin - + DE '); diff --git a/test/unit/CurlTest.php b/test/unit/CurlTest.php index 44ae05b..8ded335 100644 --- a/test/unit/CurlTest.php +++ b/test/unit/CurlTest.php @@ -13,11 +13,14 @@ function testPostToInvalidShouldThrowException() { } catch(Errors\NetworkError $exe) { $this->assertEqual('https://test.hypercharge.net/eine/falsche/url', $exe->url); $this->assertIdentical(404, $exe->http_status); - $this->assertEqual('The requested URL returned error: 404', $exe->technical_message); + $this->assertEqual('The requested URL returned error: 404 Not Found', $exe->technical_message); $this->assertPattern('/^Array\n\(\n/', $exe->body); } } - + + //TODO: failed equality tests! + //1. Wrong format ("404" vs. "404 Not Found") + //2. Wrong code "404" vs. "401" function testPostToValidUrlShouldReturnBody() { try { $curl = new Curl('user', 'passw'); @@ -75,9 +78,10 @@ function testJsonGetToInValidHostShouldThrow() { $this->fail('expected NetworkError but got none!'); } + //Throws 401 in fact! function testJsonGetToInValidUrlShouldThrow() { if(!$this->credentials('sandbox')) return; - + try { $curl = new Curl($this->credentials->user, $this->credentials->password); $curl->jsonGet(new v2\Url('sandbox', 'scheduler/123455668798797')); From c643b5093156caf4f5de24da7deb025f47ca8b40 Mon Sep 17 00:00:00 2001 From: Stefan Dvoretskii Date: Wed, 23 Nov 2016 16:56:08 +0100 Subject: [PATCH 2/4] Removed deprecated constructors & formatted test assumptions --- test/all.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/all.php b/test/all.php index 2ec3930..c170fc2 100644 --- a/test/all.php +++ b/test/all.php @@ -2,8 +2,8 @@ require_once 'test_helper.php'; class AllTests extends TestSuite { - function __construct($label=false) { - $this->label = $label; + function __construct() { + $this->label = 'all tests'; $this->collect(__DIR__.'/unit', new SimpleCollector()); } } From c8d703d8d337cd692871c15552a8f957e2f1a12c Mon Sep 17 00:00:00 2001 From: Stefan Dvoretskii Date: Wed, 23 Nov 2016 16:59:48 +0100 Subject: [PATCH 3/4] Removed deprecated constructors & formatted test assumptions --- test/unit/CurlTest.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test/unit/CurlTest.php b/test/unit/CurlTest.php index 8ded335..fa2d489 100644 --- a/test/unit/CurlTest.php +++ b/test/unit/CurlTest.php @@ -18,13 +18,10 @@ function testPostToInvalidShouldThrowException() { } } - //TODO: failed equality tests! - //1. Wrong format ("404" vs. "404 Not Found") - //2. Wrong code "404" vs. "401" function testPostToValidUrlShouldReturnBody() { try { $curl = new Curl('user', 'passw'); - $response = $curl->xmlPost('https://test.hypercharge.net/', ''); + $response = $curl->xmlPost('https://test.hypercharge.net', ''); // $response = '2013-11-12 10:54:00 BNN'; // invalid time zone // $response = 'Sat Apr 27 09:41:53 UTC 2013'; // valid // $response = '2013-11-12 19:41:53 UTC'; // valid @@ -78,7 +75,6 @@ function testJsonGetToInValidHostShouldThrow() { $this->fail('expected NetworkError but got none!'); } - //Throws 401 in fact! function testJsonGetToInValidUrlShouldThrow() { if(!$this->credentials('sandbox')) return; From e711779b18edc95c061ea366bec65ab0148efe9a Mon Sep 17 00:00:00 2001 From: Stefan Dvoretskii Date: Wed, 23 Nov 2016 17:06:42 +0100 Subject: [PATCH 4/4] Removed deprecated constructors & formatted test assumptions --- test/unit/CurlTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unit/CurlTest.php b/test/unit/CurlTest.php index fa2d489..189beb6 100644 --- a/test/unit/CurlTest.php +++ b/test/unit/CurlTest.php @@ -18,10 +18,11 @@ function testPostToInvalidShouldThrowException() { } } + //Returns "Connection to payment Gateway failed." Is it a security reason? function testPostToValidUrlShouldReturnBody() { try { $curl = new Curl('user', 'passw'); - $response = $curl->xmlPost('https://test.hypercharge.net', ''); + $response = $curl->xmlPost('https://test.hypercharge.net/', ''); // $response = '2013-11-12 10:54:00 BNN'; // invalid time zone // $response = 'Sat Apr 27 09:41:53 UTC 2013'; // valid // $response = '2013-11-12 19:41:53 UTC'; // valid