summaryrefslogtreecommitdiffstats
path: root/application/tests/Test.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-05-17 23:32:28 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-05-21 18:43:13 +0200
commita3210275b113663cd4f2133ed81bae308f63dff2 (patch)
tree35606b08d493cc08751f6ff021026057471c0e6b /application/tests/Test.php
parent1172f71ca8cc22384ab4bf7242c7645d88e0f6c8 (diff)
test: different files with same checksum
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/tests/Test.php')
-rw-r--r--application/tests/Test.php22
1 files changed, 14 insertions, 8 deletions
diff --git a/application/tests/Test.php b/application/tests/Test.php
index b9f401bdf..c11cd0cc4 100644
--- a/application/tests/Test.php
+++ b/application/tests/Test.php
@@ -43,6 +43,19 @@ abstract class Test {
// Source: http://stackoverflow.com/a/9802854/953022
protected function CallAPI($method, $url, $data = false)
{
+ $result = $this->SendHTTPRequest($method, $url, $data);
+
+ $json = json_decode($result, true);
+ if ($json === NULL) {
+ $this->t->fail("json decode");
+ $this->diagReply($result);
+ }
+
+ return $json;
+ }
+
+ protected function SendHTTPRequest($method, $url, $data = false)
+ {
$curl = curl_init();
switch ($method) {
@@ -70,14 +83,7 @@ abstract class Test {
$result = curl_exec($curl);
curl_close($curl);
-
- $json = json_decode($result, true);
- if ($json === NULL) {
- $this->t->fail("json decode");
- $this->diagReply($result);
- }
-
- return $json;
+ return $result;
}
protected function excpectStatus($testname, $reply, $status)