summaryrefslogtreecommitdiff
path: root/plugins/Minify/extlib/minify/min_unit_tests/test_Minify_Cache_Memcache.php
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-12-04 18:44:26 -0500
committerCraig Andrews <candrews@integralblue.com>2009-12-04 18:44:26 -0500
commitaab7344002fd390e5b62a3eb82f3a418fd294617 (patch)
treeb214e7d4b3e9f0ca9818fea9e3d9efa0249c00c6 /plugins/Minify/extlib/minify/min_unit_tests/test_Minify_Cache_Memcache.php
parent1fd7e5e3794621993b01a5833faa8b6fa26c3847 (diff)
parent01b089d9be046db1253cb3bb90e8635b50fddd84 (diff)
Merge branch 'minify' into 0.9.x
Diffstat (limited to 'plugins/Minify/extlib/minify/min_unit_tests/test_Minify_Cache_Memcache.php')
-rw-r--r--plugins/Minify/extlib/minify/min_unit_tests/test_Minify_Cache_Memcache.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/plugins/Minify/extlib/minify/min_unit_tests/test_Minify_Cache_Memcache.php b/plugins/Minify/extlib/minify/min_unit_tests/test_Minify_Cache_Memcache.php
new file mode 100644
index 000000000..b0223aa70
--- /dev/null
+++ b/plugins/Minify/extlib/minify/min_unit_tests/test_Minify_Cache_Memcache.php
@@ -0,0 +1,38 @@
+<?php
+require_once '_inc.php';
+
+require_once 'Minify/Cache/Memcache.php';
+
+function test_Minify_Cache_Memcache()
+{
+ $prefix = 'Minify_Cache_Memcache : ';
+ if (! function_exists('memcache_set')) {
+ return;
+ }
+ $mc = new Memcache;
+ if (! @$mc->connect('localhost', 11211)) {
+ return;
+ }
+
+ $data = str_repeat(md5('testing'), 160);
+ $id = 'Minify_test_cache';
+
+ $cache = new Minify_Cache_Memcache($mc);
+
+ assertTrue(true === $cache->store($id, $data), $prefix . 'store');
+
+ assertTrue(strlen($data) === $cache->getSize($id), $prefix . 'getSize');
+
+ assertTrue(true === $cache->isValid($id, $_SERVER['REQUEST_TIME'] - 10), $prefix . 'isValid');
+
+ ob_start();
+ $cache->display($id);
+ $displayed = ob_get_contents();
+ ob_end_clean();
+
+ assertTrue($data === $displayed, $prefix . 'display');
+
+ assertTrue($data === $cache->fetch($id), $prefix . 'fetch');
+}
+
+test_Minify_Cache_Memcache(); \ No newline at end of file