49a9609e49bfe319c449f5872e2147dac7a7a4e1
[m6w6/ext-http] / tests / header005.phpt
1 --TEST--
2 header negotiation
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 ?>
7 --FILE--
8 <?php
9
10 echo "Test\n";
11
12 function r($v) { return round($v, 2); }
13
14 $a = new http\Header("Accept", "text/html, text/plain;q=0.5, */*;q=0");
15 var_dump("text/html" === $a->negotiate(array("text/plain","text/html")));
16 var_dump("text/html" === $a->negotiate(array("text/plain","text/html"), $rs));
17 var_dump(array("text/html"=>0.99, "text/plain"=>0.5) === array_map("r", $rs));
18 var_dump("text/plain" === $a->negotiate(array("foo/bar", "text/plain"), $rs));
19 var_dump(array("text/plain"=>0.5) === array_map("r", $rs));
20 var_dump("foo/bar" === $a->negotiate(array("foo/bar"), $rs));
21 var_dump(array() === $rs);
22
23 ?>
24 Done
25 --EXPECT--
26 Test
27 bool(true)
28 bool(true)
29 bool(true)
30 bool(true)
31 bool(true)
32 bool(true)
33 bool(true)
34 Done