- changelog
[m6w6/ext-http] / tests / HttpRequestDataShare_002.phpt
1 --TEST--
2 HttpRequestDataShare global
3 --SKIPIF--
4 <?php
5 include "skip.inc";
6 checkurl("www.google.com");
7 checkcls("HttpRequestDataShare");
8 ?>
9 --FILE--
10 <?php
11 echo "-TEST\n";
12
13 $s = HttpRequestDataShare::singleton(true);
14 $s->cookie = true;
15 var_dump($s);
16
17 $r1 = new HttpRequest("http://www.google.com/");
18 $r2 = new HttpRequest("http://www.google.com/");
19
20 $r1->enableCookies();
21 $r2->enableCookies();
22
23 $s->attach($r1);
24 $s->attach($r2);
25
26 $r1->send();
27 $r2->send();
28
29 $s->reset();
30
31 if (current($r1->getResponseCookies())->cookies["PREF"] !== HttpUtil::parseCookie($r2->getRequestMessage()->getHeader("Cookie"))->cookies["PREF"]) {
32 var_dump(
33 current($r1->getResponseCookies())->cookies["PREF"],
34 HttpUtil::parseCookie($r2->getRequestMessage()->getHeader("Cookie"))->cookies["PREF"]
35 );
36 }
37
38 echo "Done\n";
39 ?>
40 --EXPECTF--
41 %sTEST
42 object(HttpRequestDataShare)#1 (4) {
43 ["cookie"]=>
44 bool(true)
45 ["dns"]=>
46 bool(true)
47 ["ssl"]=>
48 bool(false)
49 ["connect"]=>
50 bool(false)
51 }
52 Done