diff options
author | Christian Schneider | 2015-09-10 16:08:27 +0200 |
---|---|---|
committer | Christian Schneider | 2015-09-10 16:08:27 +0200 |
commit | a3628fc906934b20757907699680150242a9cb0d (patch) | |
tree | e0c980bb6a0c7e4b83d1ecfb84c6f68970d1352b /tests/it_cache.t | |
parent | 1d1e1f54a9d465ccf6db0317abfb96a7b8828f50 (diff) | |
parent | 1406935f2fb3ccd7608ae19e92187a936e6129b0 (diff) | |
download | itools-a3628fc906934b20757907699680150242a9cb0d.tar.gz itools-a3628fc906934b20757907699680150242a9cb0d.tar.bz2 itools-a3628fc906934b20757907699680150242a9cb0d.zip |
Merge branch 'master' into cs/php7
Diffstat (limited to 'tests/it_cache.t')
-rwxr-xr-x | tests/it_cache.t | 37 |
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"); |