fix http\Params::__toString() with RFC5988 payload; fix tests
[m6w6/ext-http] / tests / params016.phpt
diff --git a/tests/params016.phpt b/tests/params016.phpt
new file mode 100644 (file)
index 0000000..e5fbd97
--- /dev/null
@@ -0,0 +1,46 @@
+--TEST--
+header params rfc5988
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+$link = <<<EOF
+<https://api.github.com/search/code?q=addClass+user%3Amozilla&page=2>; rel="next", <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=34>; rel="last"
+EOF;
+
+$p = new http\Params($link, ",", ";", "=",
+       http\Params::PARSE_RFC5988 | http\Params::PARSE_ESCAPED);
+var_dump($p->params);
+var_dump((string)$p);
+?>
+===DONE===
+--EXPECT--
+Test
+array(2) {
+  ["https://api.github.com/search/code?q=addClass+user%3Amozilla&page=2"]=>
+  array(2) {
+    ["value"]=>
+    bool(true)
+    ["arguments"]=>
+    array(1) {
+      ["rel"]=>
+      string(4) "next"
+    }
+  }
+  ["https://api.github.com/search/code?q=addClass+user%3Amozilla&page=34"]=>
+  array(2) {
+    ["value"]=>
+    bool(true)
+    ["arguments"]=>
+    array(1) {
+      ["rel"]=>
+      string(4) "last"
+    }
+  }
+}
+string(162) "<https://api.github.com/search/code?q=addClass+user%3Amozilla&page=2>;rel="next",<https://api.github.com/search/code?q=addClass+user%3Amozilla&page=34>;rel="last""
+===DONE===