- fix tests
authorMichael Wallner <mike@php.net>
Fri, 29 Sep 2006 09:07:03 +0000 (09:07 +0000)
committerMichael Wallner <mike@php.net>
Fri, 29 Sep 2006 09:07:03 +0000 (09:07 +0000)
tests/HttpRequestDataShare_002.phpt
tests/HttpRequest_002.phpt
tests/HttpRequest_010.phpt

index 0b2f0ac529241cba934125e4fdfe6414fc5542da..1c7aa6fd5589ddc7e7192417693b2a252ff93996 100644 (file)
@@ -5,13 +5,13 @@ HttpRequestDataShare global
 include "skip.inc";
 checkcls("HttpRequestDataShare");
 ?>
---INI--
-http.request.datashare.cookie = 1
 --FILE--
 <?php
 echo "-TEST\n";
 
 $s = HttpRequestDataShare::singleton(true);
+$s->cookie = true;
+var_dump($s);
 
 $r1 = new HttpRequest("http://www.google.com/");
 $r2 = new HttpRequest("http://www.google.com/");
@@ -27,11 +27,25 @@ $r2->send();
 
 $s->reset();
 
-var_dump(current($r1->getResponseCookies())->cookies["PREF"] === HttpUtil::parseCookie($r2->getRequestMessage()->getHeader("Cookie"))->cookies["PREF"]);
+if (current($r1->getResponseCookies())->cookies["PREF"] !== HttpUtil::parseCookie($r2->getRequestMessage()->getHeader("Cookie"))->cookies["PREF"]) {
+       var_dump(
+               current($r1->getResponseCookies())->cookies["PREF"],
+               HttpUtil::parseCookie($r2->getRequestMessage()->getHeader("Cookie"))->cookies["PREF"]
+       );
+}
 
 echo "Done\n";
 ?>
 --EXPECTF--
 %sTEST
-bool(true)
+object(HttpRequestDataShare)#1 (4) {
+  ["cookie"]=>
+  bool(true)
+  ["dns"]=>
+  bool(true)
+  ["ssl"]=>
+  bool(false)
+  ["connect"]=>
+  bool(false)
+}
 Done
index a5569773a6b10571cb03a7db423160243db6115f..a51f00b32971d11251b278fe5bb0a4bc62197d37 100644 (file)
@@ -32,32 +32,34 @@ echo "Done";
 Array
 (
     [effective_url] => http://www.google.com/
-    [response_code] => %d
-    [connect_code] => %d
-    [filetime] => %s
+    [response_code] => 302
     [total_time] => %f
     [namelookup_time] => %f
     [connect_time] => %f
     [pretransfer_time] => %f
-    [starttransfer_time] => %f
-    [redirect_time] => %f
-    [redirect_count] => %f
-    [size_upload] => %f
+    [size_upload] => %d
     [size_download] => %d
     [speed_download] => %d
     [speed_upload] => %d
     [header_size] => %d
     [request_size] => %d
     [ssl_verifyresult] => %d
-    [ssl_engines] => Array%s
+    [filetime] => -1
     [content_length_download] => %d
     [content_length_upload] => %d
-    [content_type] => %s
+    [starttransfer_time] => %f
+    [content_type] => text/html
+    [redirect_time] => %d
+    [redirect_count] => %d
+    [connect_code] => %d
     [httpauth_avail] => %d
-    [proxyauth_avail] => %s
+    [proxyauth_avail] => %d
+    [os_errno] => %d
     [num_connects] => %d
+    [ssl_engines] => Array%s
+
     [cookies] => Array%s
-    [os_errno] => 0
+
     [error] => 
 )
 Array
index 4559be23205605bf103be7da20ad0d1001adbc95..13acd5fad74b8120340bdaee69911cb70959e7eb 100644 (file)
@@ -14,28 +14,35 @@ $r = new HttpRequest("http://dev.iworks.at/.cookie.php");
 
 $r->send();
 $c[0] = $r->getResponseInfo("cookies");
-var_dump(empty($c[0]));
+if (!empty($c[0])) {
+       var_dump('$c[0]', $c[0]);
+}
 
-$r->enableCookies();
+var_dump($r->enableCookies());
 $r->send();
-$c[1] = $r->getResponseInfo("cookies");
-var_dump(empty($c[1]));
 
-$r->resetCookies();
+$c[1] = $r->getResponseInfo("cookies");
+if (empty($c[1])) {
+       var_dump('$c[1]', $c[1]);
+}
 
+var_dump($r->resetCookies());
 $r->send();
+
 $c[2] = $r->getResponseInfo("cookies");
-var_dump($c[1] === $c[2]);
+if ($c[1] === $c[2]) {
+       var_dump('$c[1]', $c[1], '$c[2]', $c[2]);
+}
 
 $r->send();
 $c[3] = $r->getResponseInfo("cookies");
-var_dump($c[2] === $c[3]);
+if ($c[2] !== $c[3]) {
+       var_dump('$c[2]', $c[2], '$c[3]', $c[3]);
+}
 
 echo "Done\n";
 --EXPECTF--
 %sTEST
 bool(true)
-bool(false)
-bool(false)
 bool(true)
 Done