X-Git-Url: http://git.rot13.org/?p=nginx.git;a=blobdiff_plain;f=nginx_upstream_hash%2Ft%2Fhashtest.php;fp=nginx_upstream_hash%2Ft%2Fhashtest.php;h=d798ca02cf798688793539432ed813f1e2554ea4;hp=0000000000000000000000000000000000000000;hb=97ef071d42e94afeb073bf77ea4c4707c7ae669f;hpb=ae130c7b2b4158b27f1400e7850bb5e12dc17fc1 diff --git a/nginx_upstream_hash/t/hashtest.php b/nginx_upstream_hash/t/hashtest.php new file mode 100644 index 0000000..d798ca0 --- /dev/null +++ b/nginx_upstream_hash/t/hashtest.php @@ -0,0 +1,61 @@ +addServer("localhost", 11211 + $i); +} + +$test_vals = array( + 'quux' => 'baz', + 'foo' => 'bar', + 'shazam' => 'kerpow!', + 'verbum' => 'word', + 'felix' => 'happy', + 'ren' => 'stimpy', + 'Frank' => 'Julie', + 'peanuts' => 'cracker jacks', + 'all-gaul' => 'is divided into three parts', + 'the-more-tests-the-better' => 'i says', + 'adsfasw' => 'QA#(@()!@*$$*!!', + 'Swing-Low' => 'Sweet Cadillac', + 'can-has-exclamations!' => 'but no spaces or percents', + "Smile_if_you_like_UTF-8_\xa6\x3a" => "\xa6\x3b", + "8103*$)&^#@*^@!&!)*!_(#" => "whew" +); + +$curl = curl_init(); +curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + +foreach ($test_vals as $k => $v ) { + assert_equal($memcache->set("/$k", $v), TRUE, "Setting key \"$k\" via PECL"); + $memcache_url = rawurlencode($k); + curl_setopt($curl, CURLOPT_URL, "$base_url$memcache_url"); + assert_equal($v, curl_exec($curl), "Fetching key \"$k\" via Nginx"); +} + +curl_close($curl); + +if ($failures > 0) { + echo "$passes tests paseed, $failures tests failed\n"; +} else { + echo "All $passes tests passed\n"; +}