3 $base_url = "http://localhost:8081/";
7 function assert_equal($one, $two, $name)
9 global $failures, $passes;
13 echo "Test failed: $name\n";
14 echo " Expected: $one\n";
21 $memcache = new Memcache;
23 for ($i=0; $i<20; $i++) {
24 $memcache->addServer("localhost", 11211 + $i);
30 'shazam' => 'kerpow!',
35 'peanuts' => 'cracker jacks',
36 'all-gaul' => 'is divided into three parts',
37 'the-more-tests-the-better' => 'i says',
38 'adsfasw' => 'QA#(@()!@*$$*!!',
39 'Swing-Low' => 'Sweet Cadillac',
40 'can-has-exclamations!' => 'but no spaces or percents',
41 "Smile_if_you_like_UTF-8_\xa6\x3a" => "\xa6\x3b",
42 "8103*$)&^#@*^@!&!)*!_(#" => "whew"
46 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
48 foreach ($test_vals as $k => $v ) {
49 assert_equal($memcache->set("/$k", $v), TRUE, "Setting key \"$k\" via PECL");
50 $memcache_url = rawurlencode($k);
51 curl_setopt($curl, CURLOPT_URL, "$base_url$memcache_url");
52 assert_equal($v, curl_exec($curl), "Fetching key \"$k\" via Nginx");
58 echo "$passes tests paseed, $failures tests failed\n";
60 echo "All $passes tests passed\n";