fix tests
authorMichael Wallner <mike@php.net>
Mon, 6 Jun 2016 16:21:12 +0000 (18:21 +0200)
committerMichael Wallner <mike@php.net>
Mon, 6 Jun 2016 16:21:12 +0000 (18:21 +0200)
tests/bug61444.phpt
tests/negotiate001.phpt
tests/url002.phpt

index 28d267cfdd891f18599e30d210791902b657d72d..5362c714aed0d5d4243a4bfc1f71e9eb1d40945a 100644 (file)
@@ -29,7 +29,7 @@ DONE
 --EXPECT--
 http://www.example.com/foobar?bar.baz=blah&utm_source=google&utm_campaign=somethingelse&blat
 
-http://www.example.com/foobar?bar.baz=blah&utm_source=changed&utm_campaign=somethingelse
+http://www.example.com/foobar?bar.baz=blah&utm_source=changed&utm_campaign=somethingelse&blat
 
 http://www.google.com/foobar?bar.baz=blah&utm_source=google&utm_campaign=somethingelse&blat
 
index f628cdf1d9944784da44594d282bd04857f3549a..b4757c0d2e726b46a94a9a31f6d4aff6cda80434 100644 (file)
@@ -11,43 +11,48 @@ HTTP_ACCEPT_LANGUAGE=de-DE,de-AT;q=0.9,en;q=0.8,fr;q=0
 CONTENT TYPE
 
 <?php
+
+function dump($ctr) {
+       print_r(array_map(function($v){return round($v,2);}, $ctr));
+}
+
 $ct = http\Env::negotiateContentType(array("text/html","text/xml","text/json"), $ctr);
-echo "$ct: "; print_r($ctr);
+echo "$ct: "; dump($ctr);
 $ct = http\Env::negotiateContentType(array("text/xml","text/json"), $ctr);
-echo "$ct: "; print_r($ctr);
+echo "$ct: "; dump($ctr);
 $ct = http\Env::negotiateContentType(array("text/json"), $ctr);
-echo "$ct: "; print_r($ctr);
+echo "$ct: "; dump($ctr);
 ?>
 
 CHARSET
 
 <?php
 $cs = http\Env::negotiateCharset(array("utf-8", "iso-8859-1", "iso-8859-15"), $csr);
-echo "$cs: "; print_r($csr);
+echo "$cs: "; dump($csr);
 $cs = http\Env::negotiateCharset(array("iso-8859-1", "iso-8859-15"), $csr);
-echo "$cs: "; print_r($csr);
+echo "$cs: "; dump($csr);
 $cs = http\Env::negotiateCharset(array("utf-16", "iso-8859-15", "iso-8859-2"), $csr);
-echo "$cs: "; print_r($csr);
+echo "$cs: "; dump($csr);
 ?>
 
 ENCODING
 
 <?php
 $ce = http\Env::negotiateEncoding(array("gzip", "deflate", "sdch"), $cer);
-echo "$ce: "; print_r($cer);
+echo "$ce: "; dump($cer);
 $ce = http\Env::negotiateEncoding(array("", "sdch"), $cer);
-echo "$ce: "; print_r($cer);
+echo "$ce: "; dump($cer);
 ?>
 
 LANGUAGE
 
 <?php
 $ln = http\Env::negotiateLanguage(array("de", "en", "fr"), $lnr);
-echo "$ln: "; print_r($lnr);
+echo "$ln: "; dump($lnr);
 $ln = http\Env::negotiateLanguage(array("de-DE", "de-AT", "en"), $lnr);
-echo "$ln: "; print_r($lnr);
+echo "$ln: "; dump($lnr);
 $ln = http\Env::negotiateLanguage(array("nl", "fr", "en"), $lnr);
-echo "$ln: "; print_r($lnr);
+echo "$ln: "; dump($lnr);
 ?>
 
 CUSTOM
@@ -55,7 +60,7 @@ CUSTOM
 <?php
 $cc = http\Env::negotiate("a, a.b;q=0.9, c.d;q=0, *.* ; q=0.1",
     array("a.x", "c.d", "c.e", "a.b"), ".", $ccr);
-echo "$cc: "; print_r($ccr);
+echo "$cc: "; dump($ccr);
 ?>
 DONE
 --EXPECT--
@@ -103,7 +108,7 @@ LANGUAGE
 
 de: Array
 (
-    [de] => 0.99
+    [de] => 0.97
     [en] => 0.8
 )
 de-DE: Array
@@ -122,7 +127,7 @@ CUSTOM
 a.b: Array
 (
     [a.b] => 0.9
-    [c.e] => 0.1
-    [a.x] => 0.1
+    [c.e] => 0.08
+    [a.x] => 0.08
 )
 DONE
index 704ede23aaa2add3674268122ad592923a0daac0..de336a7fa60e1c8236922f788d8ae8ad54b0e795 100644 (file)
@@ -13,7 +13,7 @@ $u = "http://user:pass@www.example.com:8080/path/file.ext".
 var_dump($u === (string) new http\Url($u));
 
 $url = new http\Url($u, 
-       array("path" => "changed", "query" => "foo=&added=this"), 
+       array("path" => "changed", "query" => "bar&foo=&added=this"), 
        http\Url::JOIN_PATH |
        http\Url::JOIN_QUERY |
        http\Url::STRIP_AUTH |
@@ -40,6 +40,6 @@ NULL
 string(15) "www.example.com"
 int(8080)
 string(13) "/path/changed"
-string(38) "more%5B0%5D=1&more%5B1%5D=2&added=this"
+string(47) "foo=&more%5B0%5D=1&more%5B1%5D=2&bar&added=this"
 NULL
 DONE