summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristian Schneider2015-09-10 15:59:40 +0200
committerChristian Schneider2015-09-10 16:02:37 +0200
commit1406935f2fb3ccd7608ae19e92187a936e6129b0 (patch)
tree8014ecb523bad3e9f496a3b053cd0d3d6088da64 /tests
parenta00c93d4a333fe3558c2a9aef4c64d2bb720abbf (diff)
downloaditools-1406935f2fb3ccd7608ae19e92187a936e6129b0.tar.gz
itools-1406935f2fb3ccd7608ae19e92187a936e6129b0.tar.bz2
itools-1406935f2fb3ccd7608ae19e92187a936e6129b0.zip
Make test work on both PHP5/apcu/memcache and PHP7/memcached and name them
Diffstat (limited to 'tests')
-rwxr-xr-xtests/it_cache.t37
1 files changed, 18 insertions, 19 deletions
diff --git a/tests/it_cache.t b/tests/it_cache.t
index cb11297..66fc2d3 100755
--- a/tests/it_cache.t
+++ b/tests/it_cache.t
@@ -2,46 +2,45 @@
<?php
# test array_based process cache
-it_cache::put('it_cache_t', 1);
-ok(it_cache::get('it_cache_t') === 1);
+it_cache::put('it_cache_t', 42);
+is(it_cache::get('it_cache_t'), 42, "cache put number");
it_cache::put('it_cache_t', false);
-ok(it_cache::get('it_cache_t') === false);
+is(it_cache::get('it_cache_t'), false, "cache get number");
-it_cache::put('it_cache_t', [2]);
-ok(it_cache::get('it_cache_t') === [2]);
+it_cache::put('it_cache_t', array(2));
+is(it_cache::get('it_cache_t'), array(2), "cache put/get array");
# test non-distributed apc cache
-it_cache::put('it_cache_t', 1);
+it_cache::put('it_cache_t', 42);
unset($GLOBALS['it_cache_local']);
-ok(it_cache::get('it_cache_t') === 1);
+is(it_cache::get('it_cache_t'), 42, "local put/get number");
it_cache::put('it_cache_t', false);
unset($GLOBALS['it_cache_local']);
-ok(it_cache::get('it_cache_t') === false);
+is(it_cache::get('it_cache_t'), false, "local put/get false");
-it_cache::put('it_cache_t', [2]);
+it_cache::put('it_cache_t', array(2));
unset($GLOBALS['it_cache_local']);
-ok(it_cache::get('it_cache_t') === [2]);
+is(it_cache::get('it_cache_t'), array(2), "local put/get array");
-ok(it_cache::get('it_cache_t'.rand(1, 1000)) === null);
+is(it_cache::get('it_cache_t'.rand(1, 1000)), null, "local get unknown key");
# test distributed memcache
$GLOBALS['debug_aslive'] = 1;
-it_cache::put('it_cache_d', 1, 'distributed' => 1);
+it_cache::put('it_cache_d', 42, array('distributed' => 1));
unset($GLOBALS['it_cache_local']);
-ok(it_cache::get('it_cache_d', 'distributed' => 1) == '1');
+is(intval(it_cache::get('it_cache_d', array('distributed' => 1))), 42, "distributed put/get number");
-it_cache::put('it_cache_d', false, 'distributed' => 1);
+it_cache::put('it_cache_d', false, array('distributed' => 1));
unset($GLOBALS['it_cache_local']);
-ok(it_cache::get('it_cache_d', 'distributed' => 1) === '');
+is(boolval(it_cache::get('it_cache_d', array('distributed' => 1))), false, "distributed put/get false");
-it_cache::put('it_cache_d', [2], 'distributed' => 1);
+it_cache::put('it_cache_d', array(2), array('distributed' => 1));
unset($GLOBALS['it_cache_local']);
-ok(it_cache::get('it_cache_d', 'distributed' => 1) === [2]);
-
-ok(it_cache::get('it_cache_d'.rand(1, 1000), 'distributed' => 1) === null);
+is(it_cache::get('it_cache_d', array('distributed' => 1)), array(2), "distributed put/get array");
+is(it_cache::get('it_cache_d'.rand(1, 1000), array('distributed' => 1)), null, "distributed get unknown key");