1
0
mirror of https://github.com/mrclay/minify.git synced 2025-02-23 16:33:02 +01:00
minify/min_unit_tests/test_Minify_Cache_APC.php

31 lines
843 B
PHP
Raw Normal View History

2008-12-17 21:21:43 +00:00
<?php
require_once '_inc.php';
function test_Minify_Cache_APC()
{
$prefix = 'Minify_Cache_APC : ';
if (! function_exists('apc_store')) {
return;
}
$data = str_repeat(md5(time()) . 'í', 100); // 3400 bytes in UTF-8
2008-12-17 21:21:43 +00:00
$id = 'Minify_test_cache';
$cache = new Minify_Cache_APC();
assertTrue(true === $cache->store($id, $data), $prefix . 'store');
assertTrue(countBytes($data) === $cache->getSize($id), $prefix . 'getSize');
2008-12-17 21:21:43 +00:00
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_APC();