Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add a test for a bin file

  • Loading branch information...
commit 881f92160f60f30a33d5a25271f809c8d91b08ef 1 parent 873673d
@jeichorn jeichorn authored
View
13 tests/http/get.002.phpt
@@ -0,0 +1,13 @@
+--TEST--
+PEAR2_HTTP_Request_Adapter_Http - Test of an HTTP Get request of a binary file
+uses test003.png
+--FILE--
+<?php
+require_once dirname(__FILE__).'/../_setup.php';
+
+$adapter = new PEAR2_HTTP_Request_Adapter_Http(); // http extension
+
+// this is a shared test with only the adapter being differ
+require_once dirname(__FILE__).'/../shared/get.002.php';
+--EXPECT--
+good
View
13 tests/phpsocket/get.002.phpt
@@ -0,0 +1,13 @@
+--TEST--
+PEAR2_HTTP_Request_Adapter_Phpsocket - Test of an HTTP Get request of a binary file
+uses test003.png
+--FILE--
+<?php
+require_once dirname(__FILE__).'/../_setup.php';
+
+$adapter = new PEAR2_HTTP_Request_Adapter_Phpsocket();
+
+// this is a shared test with only the adapter being differ
+require_once dirname(__FILE__).'/../shared/get.002.php';
+--EXPECT--
+good
View
13 tests/phpstream/get.002.phpt
@@ -0,0 +1,13 @@
+--TEST--
+PEAR2_HTTP_Request_Adapter_Phpstream - Test of an HTTP Get request of a binary file
+uses test003.png
+--FILE--
+<?php
+require_once dirname(__FILE__).'/../_setup.php';
+
+$adapter = new PEAR2_HTTP_Request_Adapter_Phpstream();
+
+// this is a shared test with only the adapter being differ
+require_once dirname(__FILE__).'/../shared/get.002.php';
+--EXPECT--
+good
View
14 tests/shared/get.002.php
@@ -0,0 +1,14 @@
+<?php
+$url = $testServer.'test003.png';
+
+$http = new PEAR2_HTTP_Request($url,$adapter);
+$http->verb = 'GET';
+$response = $http->sendRequest();
+
+// compare md5sum of the body
+if ('3e4c6173971d58992d2f87f7045619f8' === md5($response->body)) {
+ echo "good\n";
+}
+else {
+ echo $response->body;
+}
View
BIN  tests/testFiles/test003.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.